Group Ranks in Game Teams

Greetings!

My name is GoingRiich and I need help with making a script.

I want to make teams inside my game with my Roblox Group Ranks but I do not know how to make a script or something in order for that to happen.

Can you guys maybe help a guy in need?

Thank you! Appreciate it.

(I do not have a script because I do not know how to script, I want someone to help me make a script for this.)

1 Like

Scripting support isn’t a place to get code done for you.

With that said you can use these.

https://developer.roblox.com/en-us/api-reference/event/Players/PlayerAdded

https://developer.roblox.com/en-us/api-reference/function/Player/GetRoleInGroup

3 Likes

Well what you can do is when you create the leaderstats, you wanna make a value named Rank, make sure it’s a string. After that check the rank in the group. For example if the players rank number in the group is 1 then their rank will be “Member”

game.Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder",player)
	leaderstats.Name = "leaderstats"
	
	local Rank = Instance.new("StringValue",leaderstats)
	Rank.Name = "Rank"
	
	if player:GetRankInGroup(GroupId) == RankNumber then
		Rank.Value = "RankName"
	end
end)

If you don’t know the ID of the group its the numbers in the URL of the group. To get the rank number you check in the group like so:

1 Like

Hey! I appreciate your response, but can you be a little more specific? I don’t know anything about scripting, sorry.

Yeah, so this how it works:

  1. Player joins, makes a leaderboard
  2. After leaderboard is made, it makes a value inside the leaderboard, for example like KOs. (In this case its called Rank)
  3. It checks if the player is in the group and what rank they are. Once found it sets the Rank Value to whatever you want their rank to be named i.e: Member, Admin, Owner, etc.

Hopefully the images helped! (Make sure you put this in a Script, not a local script, in ServerScriptService)

1 Like

Thank you, but will I also have to make the Teams in studio? Sorry for so many questions asked. Also what if I want to add multiple teams?

You can add teams in Studio. Just simply look in the explorer for teams (Towards the bottom and right click and select team)

1 Like

And to add multiple ranks/teams in the script? Do I do the same just beneath the previous one?

No, just one script with those lines will do the job. It will update whenever you join a different team. If you get promoted or demoted in the group, you have to rejoin the game for the rank to update ingame.

Alrighty! Thank you. Appreciate it.

1 Like

Hey! So it did not work.

I basically want my school group ranks to be a team in game. And it did not work, I don’t know what it means (groupid) on the script, do I put the group id or the group rank number?

To get the group Id you wanna make sure you go the group page, then click on the group. Afterwards go to the URL and look for code like this:


That is the groupID.

if player:GetRankInGroup(5496315) == 220 then
	Rank.Value = "RankName"
end

Will I have to create a Team for each role in studio?

Also why did you add the 220? Sorry for the bother and questions.

220 is the code of the rank inside of the group.

Yes, you will have to if you want for it to be a member, or you can create them using instance.new().

Something easier in StarterGui, create a Script with the condition of Player:

local Player = game.Players.LocalPlayer
Player:GetRankInGroup(GROUP_ID) >= ID then
Player.Team = game.Teams["TEAM_NAME"]
end

GetRankInGroup() = ID of Rank
GetRoleInGroup() = Name of Rank Example: (“Founder”)

If you change the players team via LocalScript, it won’t change on the server, only for the client. (Assuming Filtering Enabled is on, which it should be) You’ll need to create a remoteEvent for the client to tell the server to create a new team. However, I’d suggest you add some security with that as an exploiter can spam that event and create several teams which could cause the server to crash.

Yes! I’m dumb it need be a Script in ServerScriptService, sorry.