Hi everyone, I'm trying to adjust my basic leaderboard script so that the rank on the leaderboard will change depending on what team you are on. Each team in my game has a group that you must be in, to actually join the team. Also, the ranks for each group for an individual may be different.

For example, there are four teams in my game; Apple team, Banana team, Grape team, Melon team.

Now, these teams all have a group made for them. The player must be in the group to join the team. For example, they must be in the Apple group to join the Apple team. I already have this code working.

But the problem is, I want my code to change the players rank on the leaderboard depending what team they are on. Let's say my group rank on Apple is "Prince", but my group rank on Banana is "Major", I want to make it so that whenever I change team, it would grab my group rank from the teams group and change it on the leaderboard.

Here is my current leaderboard script:


game.Players.PlayerAdded:connect(function(player)

local leaderstats = Instance.new("IntValue")
leaderstats.Name = "leaderstats"
leaderstats.Value = 0

local Rank = Instance.new("StringValue")
Rank.Name = "Rank" 
Rank.Value = player:GetRoleInGroup(6393465) 
leaderstats.Parent = player
Rank.Parent = leaderstats

end)

My group ids are, 6393465 and 6441800.

Any help would be appreciated!

2 comments

0

code blocks pls

0

Sorry about that, I'm new to this aha. I've added code blocks.