I am trying to make a script that kills the person you are chatting about(admin command). It works fine until I tried to add a part that lets you shorten names. I am pretty sure I did something wrong with my math since there are no errors.
local Player=game.Players.LocalPlayer
Player.Chatted:connect(function(Text)
if string.sub(Text,1,4)=="Kill" or "kill" or "KILL" then
for i,v in pairs(game.Players:GetChildren()) do
for i=7,tonumber(string.len(v.Name)),1 do
local Length=tonumber(string.len(Player.Name))
if string.sub(Text,6,i)==string.sub(v.Name,1,Length-(i-6)) then
--I think its something above and between[ ]
v.Character.Humanoid.Health=0
end
end
end
end
end)
--[["Kill tuma"
123456789]]
