Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I add more than 1 person to the adminlist?

Asked by
Oskee 0
9 years ago

I'm trying to make my own admin commands, and first one I'm doing is a kill command. I want to add more than 1 person to the admin list, so I've tried changing it. Here's the code. It doesn't reconigize me as an admin.

function onChatted(plr,msg) if plr.Name == {"Oskee","tyzone","korrium"} and string.lower(string.sub(msg,1,5)) == "kill." then char = game.Workspace:findFirstChild(string.sub(msg,6)) if char then h = char:findFirstChild("Humanoid") if h then h.Health = 0 else print("No humanoid!") end --note to self, make it shorter lines

else print("No character to be found!") end else print("Either you're not a admin, or you can't spell.") end end game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(player, message) end) end)

1 answer

Log in to vote
0
Answered by 9 years ago
local admins = {"Oskee","tyzone","korrium"} 
function checkadmin(player)
local a = false
for i = 1,#admins do
if admins[i] == player then
a = true
end
return a
end
function onChatted(plr,msg) 

if checkadmin(plr.Name) and string.lower(string.sub(msg,1,5)) == "kill." then char = 
game.Workspace:findFirstChild(string.sub(msg,6))
if char then
 h = char:findFirstChild("Humanoid") 
if h then 
h.Health = 0 else print("No humanoid!") end --note to self, make it shorter lines

else print("No character to be found!")
 end
 else 
print("Either you're not a admin, or you can't spell.") 
end 
end 

game.Players.PlayerAdded:connect(function(player) player.Chatted:connect(function(message) onChatted(player, message) end) end)

try this.

you need to check each member of a table for what you are looking for instead of checking if their name is a table.

Ad

Answer this question