Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I make teams for a group rank. Like HR, MR, and LR?

I'm trying to script a Cafe and I can't seem to find out a script that can help make teams for specific group ranks. Please Help

2 answers

We can use the player's GetRankInGroup() method, which takes a group ID as an argument and returns an integer, which is the roleset number. To see roleset numbers, head over to your group's Group Admin page, and go to the Roles tab. GetRankInGroup() will return 0 if the player is not in the group.

local groupId = 1
game.Players.PlayerAdded:Connect(function(player)
	local rank = player:GetRankInGroup(groupId)

	if rank == 0 then
		player.Team = game.Teams.NonMembers
	elseif rank >= 1 and rank <= 100 then
		player.Team = game.Teams.LowRanks
	elseif rank >= 101 and rank <= 200 then
		player.Team = game.Teams.MidRanks
	elseif rank >= 201 and rank <= 255 then
		player.Team = game.Teams.HighRanks
	end
end)

Modify the script as needed and you have it done!

1 comment

0

It doesn't work local groupId = 3220621 game.Players.PlayerAdded:Connect(function(player) local rank = player:GetRankInGroup(groupId) 01 if rank == 0 then 02 player.Team = game.Teams.NonMemers 03 elseif rank >= 1 and rank <= 5 then 04 player.Team = game.Teams.Low Ranks 05 elseif rank >= 6 and rank <= 8 then 06 player.Team = game.Teams.MidRanks 07 elseif rank >= 9 and rank <= 15 then 0 

It doesn't work

local groupId = 3220621 game.Players.PlayerAdded:Connect(function(player) local rank = player:GetRankInGroup(groupId)

if rank == 0 then
    player.Team = game.Teams.NonMemers
elseif rank >= 1 and rank <= 5 then
    player.Team = game.Teams.Low Ranks
elseif rank >= 6 and rank <= 8 then
    player.Team = game.Teams.MidRanks
elseif rank >= 9 and rank <= 15 then
    player.Team = game.Teams.HighRanks
elseif rank >= 16 and rank <= 255 then
    player.Team = game.Teams.SpecialRanks
end

end)

This discussion is preserved as it was. New answers, comments, and votes are closed.