chattable = {}
function inlist(Plr)
for key,player in pairs(chattable) do
if Plr.Name == player then return true end
end
end
game.Players.PlayerAdded:connect(function(newPlayer)
if newPlayer:IsInGroup(508662) then
newPlayer.Chatted:connect(function(chatmsg)
if chatmsg:sub(1,17) == "Give Commands to " then
local player = chatmsg:sub(18, chatmsg:len())
if game.Players:FindFirstChild(player) then
table.insert(chattable, player)
end
end
end)
end
end)
function Persons(Plr)
if ingroup(Plr) or inlist(Plr) then
Plr.Chatted:connect(function(Msg,rec) Chatted(Plr,Msg) end)
end
end
game.Players.PlayerAdded:connect(Persons)
Plr = game.Players:GetChildren()
for i = 1,#Plr do
Persons(Plr[i])
end
The first function shows the part where it checks to see if a person's name is in the chattable. The second function shows the part where admins can add people to this chattable list. The only problem is: it's not working. I'm pretty sure I called it correctly in the last function, but I may be wrong. Can someone help me and explain to me why this doesn't work? Thanks. (By the way, ignore the ingroup(Plr) part. It doesn't relate to this issue.)

2 comments
There's an error with the chatmsg part on 11. It says, "Unknown global 'chatmsg'"
Nvm, I fixed the problem by myself. Thanks anyways.