Hey folks, today I was attempting to make my admin command script(with the help of the wiki).
While I don't see anything wrong with the script, it doesn't work.
--Original script made by Thetacah
--Ban script
--Last Modified:2016/08/28
local admins = {[37040233] = true}
local bannedlist = {}
function findplayer(name)
for i, v in ipairs(game.Players:GetPlayers()) do
if(v and v.Character) then
if v.Name:lower() == name:lower() then
return v
end
end
end
end
function chatted(msg, plr)
--We are admin
if(admins(plr.userId)) then
if(string.lower(msg:sub(1,5)) == "kill/") then
local killVictim = findplayer(msg:sub(6))
if(killVictim and killVictim.Character) then
killVictim.Character:BreakJoints()
end
end
if(string.lower(msg:sub(1,5)) == "kick/") then
local kickVictim = findplayer(msg:sub(6))
if(kickVictim and kickVictim.Character) then
kickVictim:Kick()
end
end
if(string.lower(msg:sub(1,4)) == "sit/") then
local sitvicitim = findplayer(msg:sub(5))
if(sitvicitim and sitvicitim.Character) then
sitvicitim.Character:FindFirstChild("Humanoid").Sit = true
end
end
end
end
--When player chats, run this
game.Players.PlayerAdded:connect(function(plr)
plr.Chatted:connect(function(msg)
chatted(msg,plr)
end)
for i, v in pairs(bannedlist) do
if(v) then
if(plr.userId == v) then
plr:Kick()
end
end
end
end)

1 comment
Line 24, error should be admins is not a valid function. You should be using brackets, not parenthesis, for a table like that. admins[plr.UserId]