So I am making something which restricts players for joining apart from a player in a group with a certain role. I tried doing this:
local Roles = {
255;
253;
252;
251;
248;
}
game.Players.PlayerAdded:Connect(function(Player)
for i,v in ipairs(Roles) do
if (Player:GetRankInGroup(-GROUPID-)) == v then -- Limits who joins
print("Allow")
else
Player:Kick("Not allowed to join") -- Change kick message
end
end
end)
Now it does work, however if you are one of the ranks, then your not the other ranks so then you get kicked for not being those ranks. How would I fix this?

5 comments
if all of the "allowable" ranks are above 248, why not just do if group rank >= 248?
Because notice how its- 248, then 251. 249, 250 are skipped so I cant do that
ah ok, ive never done anything with roles or ranks so i dont know how theyre structured
you could have your if statement check through the roles one at a time, Roles[1] or Roles[2] or etc, its a more messy way to do it but would remove the issue you're having.
Alright ill do that then. Thanks