|
| 11 Dec 2011 05:39 PM |
I'm making an admin script, but I can't get the findPerson function right. I want to select people like "kill/all" or "kill/others" or "kill/(player name)".Can someone help?
|
|
|
| Report Abuse |
|
|
| 11 Dec 2011 05:58 PM |
all = game.Players:GetPlayers()
game.Players.PlayerAdded:connect(function(newPlayer) local function getOthers(Player) local others = {} for i, v in pairs(game.Players:GetPlayers()) do if v.Name ~= Player.Name then table.insert(others, v) end end return others end
local others = getOthers(newPlayer) newPlayer.Chatted:connect(function(Message) if Message:sub(1,5):lower() == "kill/" then if Message:sub(6):lower() == "all" then for i, v in pairs(all) do if v.Character then v.Character:BreakJoints() end end elseif Message:sub(6):lower() == "others" then for i, v in pairs(others) do if v.Character then v.Character:BreakJoints() end end else local player = game.Players:FindFirstChild(Message:sub(6)) if player and player.Character then player.Character:BreakJoints() end end end end) end)
That might work. I haven't tested it. |
|
|
| Report Abuse |
|