I don't know why I still can use ;kill Player when Player isn't in admins.
Script:
admins = {"d"} function findPlayer(name) for _, player in ipairs(game.Players:GetPlayers()) do if player.Name:lower() == name:lower() then return player end end end game.Players.PlayerAdded:connect(function(plr) for i,v in pairs(admins) do plr.Chatted:connect(function(msg) if msg:sub(1,5) == ";kill" then victim = findPlayer(msg:sub(7)) if victim and victim.Character then victim.Character:BreakJoints() end end end) end end)
The reason is because you never actually checked if they are in the admin array.
All you did was:
for i,v in pairs(admins) do plr.Chatted:connect(function(msg) --blah end) end
In for i,v in pairs(admins) do
you are merely only iterating through the table, but not even giving the script anything to do for each item in the table.
That's like saying in real life:
For everyone here.
Alright. Great. You've told us that the subject is 'Everyone' but you haven't told us what to do with the subject.
If you are making this an admin system, then you can change your code to the following:
admins = {"d"} function findPlayer(name) for _, player in ipairs(game.Players:GetPlayers()) do if player.Name:lower() == name:lower() then return player end end end function isAdmin(plr) for _,v in pairs(admins) do if v:lower() == plr.Name:lower() then return true end end return false end game.Players.PlayerAdded:connect(function(plr) if isAdmin(plr) then plr.Chatted:connect(function(msg) if msg:sub(1,5) == ";kill" then victim = findPlayer(msg:sub(7)) if victim and victim.Character then victim.Character:BreakJoints() end end end) end end)
You must check to see if the player is in the admin list BEFORE you decide to listen to what they say
game.Players.PlayerAdded:connect(function(plr) for key, value in pairs(admins) do if value == plr.Name then --EDIT plr.Chatted:connect(function(msg) if msg:sub(1,5) == ";kill" then victim = findPlayer(msg:sub(7)) if victim and victim.Character then victim.Character:BreakJoints() end end end) end end end)