Tutorial:Leaderboard Stats (leaderstats)



If you ever played a game on Roblox, there's a high chance you've probably seen a leaderboard on the side of your screen, those that display every player's stats. Today I'm going to show you how it works and how to make your own!

How it Works
Leaderstats are put on the player list when at least one player has an instance named "leaderstats" parented to the player. Remember, the instance has to be named exactly "leaderstats". No capitals or anything else. All lowercase exactly like that.

When one player has leaderstats and others don't, their stats appear as a dash. (-)

Leaderstats automatically sort whether it's a string or a number. If two players have the same value, the board will sort alphabetically. Keep in mind with string values that 1.1k will be seen as less than 4 so it's recommended to use number/integer values with leaderstats.

How to Make it
So we know how to make leaderstats appear, but how do we achieve it. There's 2 different ways of achieving this.

Technique 1: Cloning

This way is the easiest way because all we have to do is clone an existing Instance into a player that joins.

What we need to do is make an instance ( is best recommended) and place it under the script or in ServerStorage (it does not really matter)

Then just paste this script

Technique 2: From scratch

Even though it's more tedious than cloning, its the more popular way of handling this. Basically what they does create every instance from scratch. All we need is a server script, it doesn't matter where it is but I recommend placing it under ServerScriptService.

Then of course, paste this in

You can change the values by editing the properties but Technique 1 is easier to edit for people without much knowledge of scripting.