In every player requirements to be inserted a value dubbed "leaderstats", utilizing a manuscript with the PlayerAdded event. Inside the leaderstats value, you can place IntValues - their name is what will show as the heading, and also their worth is what will show up as the player"s stat.

You are watching: How to add a leaderboard on roblox

To make those stats change, you need to add different functions and/or occasions to the manuscript that created the leaderstats values.


*

Insert a script right into workspace, then in the code type this:

function Onplayerentered(player)local leaderstats = Instance.new("IntValue")leaderstats.Parent = playerleaderstats.Value = 0leaderstats.Name = "leaderstats"local stat = Instance.new("IntValue")stat.Name = "" -- put name right here in in between the quotationsstat.Value = -- put the starting Value#endgame:GetService("Players").ChildAdded:Connect(Onplayerentered)

*

*

*

Roblox leaderboards is a an extremely long script, thankfully, the script enable us to easily include and remove leaderstats. To add a leaderboard insert a IntValue inside of the player object, to add a stat insert a IntValue within the leadestats.

Most gamings on Roblox desire every player to have the very same leaderboard. Therefore most people use a PlayerAdded event and create the leaderboard


*

Insert a script right into ServerScriptService and also paste down the following code:

plrEntered = function(plr) neighborhood ls = Instance.new("IntValue") --Leaderstats ls.Parent = plr ls.Value = 0 ls.Name = "leaderstats" local stat = Instance.new("IntValue") stat.Name = "Money" -- readjust to the value you desire stat.Value = 0 -- include the starting valueendgame:GetService"Players".PlayerAdded(plrEntered)
ROBLOX specifies a leaderboard as things that is named as "leaderstats" and also is situated in the player object. A leaderboard statistic is defined as a value object within the leaderstats object (Player>leaderstats>ValueObject). So allows write a role that create a leaderboard v a "cash" statistic because that a player.

local function createLeaderboard(player) neighborhood stats = Instance.new("Folder") stats.Name = "leaderstats" neighborhood cash = Instance.new("IntValue", stats) cash.Name = "Cash" stats.Parent = playerendThen we should make this work. We require to affix this duty to the "PlayerAdded" event from the "Players" object.

See more: What Kind Of Shoes Did Greasers Wear ? How Did The Greasers Dress In The Outsiders

local football player = game:WaitForChild("Players")players.PlayerAdded:connect(createLeaderboard)And the is basically it.Note that line 3 in the code displayed directly above is the equivalent of:

players.PlayerAdded:connect(function(player) createLeaderboard(player)end)The entire script would certainly look choose this:

local football player = game:WaitForChild("Players")local duty createLeaderboard(player) neighborhood stats = Instance.new("Folder") stats.Name = "leaderstats" local cash = Instance.new("IntValue", stats) cash.Name = "Cash" stats.Parent = playerendplayers.PlayerAdded:connect(createLeaderboard)It is encourage to put the manuscript in the "ServerScriptService".