Group Rank to Team help!

Hello there, my name is Dani.

I need help trying to make it so if you have a certain rank in a group or higher, it makes you auto join a team. Fo example, if I am a SHR at a group, it makes me join Administration the moment I join the game.

Thanks! Hope to find some help.

so there is a function called Player:GetRoleInGroup you can use it to set the team

In addition to what @Qinrir said :


game.Players.PlayerAdded:connect(function(newPlayer)
    local rank = newPlayer:GetRankInGroup(0000000) --your group id 
	if rank == 255 then -- change to your rank number 
		--assign him to a team
    end
end)

Or, you can use GetRoleInGroup()


game.Players.PlayerAdded:connect(function(newPlayer)
	local rank = newPlayer:GetRoleInGroup(000000) --your group id
	--do stuff
end)


getroleingroup is much better as it help new players understand better

True, depends on his choice and what he prefers to use

Ok so for the assign team, how would I do that?

Insert a team into Teams, make sure AutoAssignable is false,

and do this :

game.Players.PlayerAdded:connect(function(newPlayer)
	local rank = newPlayer:GetRankInGroup(0000000) --your group id 
	if rank >= 254 then -- change to your rank number 
		local team = game.Teams["YOURTEAMNAME"]
		if team and rank then
			newPlayer.Team = team
		end
	end
end)
1 Like

Alright, thank you very much! I greatly appreciate this!

1 Like

Iā€™d argue GetRankInGroup is more new-user friendly as comparing numbers is a lot more intuitive than comparing strings.

2 Likes