I've recently scripted an AI with a friend. He made this FindPlayer function, and the kill command, but every time we go into a game and do "Matrix, kill PLAYER", it kills everyone in the game. We don't know the error to this. It runs just fine. We have tried to fix this over and over.
We think the error may occur here:
function FindPlayer(GivenString) local Chars = {} if GivenString == "me" then table.insert(Chars, Plr) elseif GivenString == "all" or GivenString == "everyone" or GivenString == "everybody" then for i,v in pairs(game:GetService("Players"):GetPlayers()) do table.insert(Chars, v) end else for i,v in pairs(game:GetService("Players"):GetPlayers()) do if v.Name:sub(1, GivenString:len()):lower() == GivenString:lower() then table.insert(Chars, v) end end end return Chars end
or here:
AddCommand("Kill", "matrix, kill", function(arg) Args = GetArgs(arg, " ") KilledPlayers = {} for i,v in pairs(FindPlayer(Args[1])) do pcall(function() table.insert(KilledPlayers, v.Name) v.Character:BreakJoints() end) end MakeChat("Killed player(s) " .. table.concat(KilledPlayers, ", ") .. ".") end)
Here, check out this thread, it may help with your question with the FindPlayer; http://wiki.roblox.com/index.php?title=Advanced_Admin_Commands I hope this helped!