how? im trying to make a kill script so if i say like ;kill soni it will kill sonichfan
COMMUNITY QUESTION
How to compare a string to children in a folder?
1 answer
what i think you can do is this server script:
local admins = {
1, -- user ids lol
2,
3,
}
game:GetService("Players").PlayerAdded:Connect(function(plr)
if not table.find(admins, plr.UserId) then return end -- if he not an admin then this script will just be like nope
plr.Chatted:Connect(function(msg) -- if an admin chatted
if string.find(msg, ";kill") then -- if they said ;kill (insert player name)
for i,v in ipairs(game:GetService("Players"):GetPlayers()) do -- search all players
if string.find(v.Name, string.sub(msg,6,-1)) then -- if there is a player with the name the admin specified (shortforms allowed)
local OmaeWaMuShindeiru = v.Character -- their character
local Nani = OmaeWaMuShindeiru:FindFirstChildWhichIsA("Humanoid") -- their character's humanoid
if not Nani then return end -- if no humanoid the script be like nope
Nani.Health = 0 -- kill the humanoid
Nani:ChangeState(15) -- in case changing health doesn't work for some reason, we change their humanoids state to the dead state
end
end
end
end)
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
baka -me to me
weebs