Cant get a group team auto assigner to work

For a while now i have been trying to make a group team auto assigner to work.
Basically what im trying to do if your in a group and a certain rank in the group it would put you into a different team.

This is what i have so far.

function onPlayerEntered(plyr)
if plyr:IsInGroup(6003664) == 249 then  --The group id and rank
plyr.TeamColor = BrickColor.new("New Yeller")
end
end

game.Players.PlayerAdded:connect(onPlayerEntered)

If you could help and would really help me

1 Like

The IsInGroup function only checks if they’re in the group, you’ll need to use GetRankInGroup to get the player’s rank in the group:

function onPlayerEntered(plyr)
if plyr:GetRankInGroup(6003664) == 249 then  --The group id and rank
plyr.TeamColor = BrickColor.new("New Yeller")
end
end

game.Players.PlayerAdded:Connect(onPlayerEntered)

Also, :connect is deprecated - use :Connect

4 Likes

Thank you! Worked perfectly fine thanks for the help!