I'm making a new command for my admin.
when i tested out this ;admin command, it didn't work. (i did it on someone who wasn't in the admins table)
admins = {"Player", "dragonmaster4111"}
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
if v == plr.Name then
plr.Chatted:connect(function(msg)
if msg:sub(1,6) == ";admin" then
adm = findPlayer(msg:sub(8))
if adm and adm.Character then
table.insert(admins, 3, adm)
end
end
end)
end
end
end)

1 comment
you were inserting adm into the table, which is an object. To fix it, on line 6 do return player.Name instead of return player