Okay so I have a for loop checking if the player speaking is in the Admins array. It only check the players name against the first object in the array. what's going wrong? No errors are being outputted. Code:
local Admins = {"MrLonely1221","Player1"};
function isAdmin(plr)
for i, v in pairs(Admins) do
print(i,v);
if plr == v then
return true;
else
if GroupAdmin then
if game.Players:FindFirstChild(plr):IsInGroup(GroupID) then
if game.Players:FindFirstChild(plr):GetRankInGroup(GroupID) >= GroupRank then
return true;
end;
end;
end;
print("No no no");
return false;
end;
end;
end;
game.Players.PlayerAdded:connect(function(player)
player.Chatted:connect(function(msg)
if isAdmin(player.Name) then
print("hi");
end;
end;
end;
It prints "No no no" and then returns false. Any idea as to why it does this? Here is the output: 1 MrLonely1221 No no no

2 comments
I do use tabs, not spaces. And I was tired when trying to make this. I figured out the problem without reading all the way through your solution. Thank your for the answer though, I moved my return false outside the for and then read through your answer and saw it. Thank you though. I'm going to select this as the answer, because it is, and so that others can see that this does help and has been f
No problem lol