Leaderboard ranking system

Hello, devs!
So I want to make a automatic ranking system.
Explanation:
Hypothetically, there is a leaderstats script with stat called “followers”. When, for example, they reach 1000 followers, the rank, which is stringvalue in leaderstats, changes to another and so on with more and more followers.

How can I achieve it?

Thanks in advance.

When you say ranking, do you mean their role in the group, or inside of the game?

Inside the game.
I.e
They do their thing… get 1000 followers
and a stringvalue in the leaderstats changes.

To achieve that you should basically do a table of values and ranks and check everytime the followers number updates. When it updates, if the player reaches a certain amount of followers it will be given a new rank.

Oh well, obviously you must do all the leaderstats things before doing the rank system.

Okay, you could do something like this.
Note, you will need some way to get the player, and a local script would not give you the desired outcome, so this is a server script. You could put it in a player added function, or whatnot.

player.leaderstats.Followers:GetPropertyChangedSignal("Value"):Connect(function()
     if player.leaderstats.Followers.Value == 1000 then
        player.leaderstats.StringValue.Value == "Put the rank name here" --Change StringValue to whatever the value's name is. 
     end 
end)

Also, if it is possible for them to not gain followers in an increment of one, you will want to add limits. So, let’s say it takes 1000 to get one rank, you would want to do >= 1000 and <= 2000 so that they don’t get the same rank if they are in the range of a new rank.

If you were to implement a table, it would be less code and more organized, but this is the backbone to what you need to do.

7 Likes

If you would like to get the ranks from the table you could use a for loop to check the ranks and values in the table and then comparate them with the followers of the player.