How to make a group rank leaderboard

Hello I’m trying to achieve making a Group rank leader board basically in short in our game there is different ranks and whatever rank you are in the group you will be assigned to based on the team name from within the group. so far I have got a leader board that gives your rank from within the roblox group through the Id. But am stuck as how I am suppose to link the leaderboard to the teams in Roblox studio

I have tried looking up things to help me such as Player connected functions and things but If i can get some assistance with what I need to do that would help. Thank you.

1 Like

So do add a group rank there are loads of YT tutorials like this one please research more before posting. Thanks I hope this helped ya out…

if plr:GetRankInGroup(groupID) then
    plr.Team = game.Teams["Your Team"]
end
1 Like

The easiest way to do this is to first add a value in the player leaderstats to called rank. You could then use the GetRoleInGroup to get the name of the players rank and then display it in the leaderboard. Your script would look something like this:


local groupID = 12321313 --- ID of the group

game.Players.PlayerAdded:Connect(function(plr)
local ldr = instance.new('Folder',plr) -- Creating the leaderstats
ldr.Name = 'leaderstats'

local Val = instance.new('StringValue',ldr) -- Creating the value Rank
Val.Name = 'Rank'

Val.Value = tostring(plr:GetRoleInGroup(groupID)) -- Setting the value to the players group rank
end)

This would display the players rank name in the leaderboard

2 Likes

Okay thank you I will try that.

Okay so I have managed to make my leaderboard but am now trying to make it so players in my group are put into their respective teams how can I go about doing that? at the moment it defaults me as a student.

if plr:IsInGroup(YourGroupID) then
    plr.Team = game.Teams["team name"]
end

Does that code need to be added onto my Leaderboard script?

Yes 30charactersssssssssssssssssss

An simple solution would be, and research more the subject before posting it here.

game.Players.PlayerAdded:Connect(function(Player))
    local leaderstats = Instance.new("IntValue")
	leaderstats .Name = "leaderstats"
	local Rank = Instance.new("IntValue")
	Rank.Name = "Rank"
	Rank.Value = Player:GetRankInGroup(GroupId)
	Rank.Parent = stats
		
	leaderstats.Parent = Player
end)
1 Like

Wow for it helped me i was same browsing for this