Roblox leaderboard script (leaderstats)

Put any stat — Coins, Kills, Stage — on the player list in the top-right corner. One server script, plus a kill counter and saving.

ScriptUpdated November 2, 2026

Where to put it

Script — ServerScriptService > Leaderstats (Script). It runs on the server, so players can't change what it does.

  1. Insert a Script into ServerScriptService and paste the code.
  2. Press Play: the player list now shows a Coins column.

The script

ServerScriptService > Leaderstats (Script)
local Players = game:GetService("Players")

local function onPlayerAdded(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats" -- must be exactly this, lowercase
	leaderstats.Parent = player

	local coins = Instance.new("IntValue")
	coins.Name = "Coins"
	coins.Value = 0
	coins.Parent = leaderstats
end

Players.PlayerAdded:Connect(onPlayerAdded)
for _, player in Players:GetPlayers() do
	task.spawn(onPlayerAdded, player)
end

How it works

  • Roblox shows every value inside a folder named exactly leaderstats under the Player as a column on the player list.
  • Use IntValue for whole numbers and NumberValue for decimals. The first value is the one the list sorts by.
  • Change the stat from any server script: player.leaderstats.Coins.Value += 10.

Variations

Kills counter

Gives a kill to the player who last damaged someone. Your weapon scripts set the creator tag on hit — the Roblox convention — and this script reads it when the victim dies.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local kills = Instance.new("IntValue")
	kills.Name = "Kills"
	kills.Parent = leaderstats

	player.CharacterAdded:Connect(function(character)
		local humanoid = character:WaitForChild("Humanoid")
		humanoid.Died:Connect(function()
			local tag = humanoid:FindFirstChild("creator") -- ObjectValue set by weapons
			local killer = tag and tag.Value
			if killer and killer:IsA("Player") and killer ~= player then
				killer.leaderstats.Kills.Value += 1
			end
		end)
	end)
end)

Saving the leaderboard

leaderstats reset when a player leaves. To keep them, save the values with a data store — see the data store script.

Common mistakes

  • Naming the folder Leaderstats or leaderStats — it must be all lowercase.
  • Creating leaderstats in a LocalScript: the server and other players won't see it.
  • Using a StringValue for numbers — sorting and math won't work.

FAQ

Why isn't my leaderboard showing?

The folder must be named exactly leaderstats (lowercase), be parented to the Player object, and be created by a server Script.

How do I make a global leaderboard in Roblox?

Global leaderboards use an OrderedDataStore: save each player's score with SetAsync, then read the top entries with GetSortedAsync and show them on a SurfaceGui.

Keep reading