top of page

Roblox Studio Leaderboard ScriptStep

Writer's picture: TerminatorTerminator

Step 1: Open Roblox Studio and Create a New Place

  1. Open Roblox Studio.

  2. Click on "New" to create a new place or open an existing place where you want to add the leaderboard.

Step 2: Insert a Leaderboard Script

  1. In the Explorer window, right-click on ServerScriptService.

  2. Select Insert Object and then choose Script. This will add a new script to the ServerScriptService.

Step 3: Write the Leaderboard Script

  1. Rename the script to LeaderboardScript for clarity.

  2. Double-click on the script to open it.

  3. Copy and paste the following code into the script:

 
  1. -- Create a new leaderboard when a player joins the game game.Players.PlayerAdded:Connect(function(player) -- Create a leaderstats folder local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player -- Create a new IntValue for the player's score local score = Instance.new("IntValue") score.Name = "Score" score.Value = 0 -- Initial score value score.Parent = leaderstats end)

 
  1. Step 4: Customize the Leaderboard

You can add more stats to the leaderboard by creating additional Instance.new("IntValue") or Instance.new("StringValue") objects inside the leaderstats folder. For example, to add a Coins stat, you can modify the script as follows:

 

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

local leaderstats = Instance.new("Folder")

leaderstats.Name = "leaderstats"

leaderstats.Parent = player


local score = Instance.new("IntValue")

score.Name = "Score"

score.Value = 0

score.Parent = leaderstats


local coins = Instance.new("IntValue")

coins.Name = "Coins"

coins.Value = 0

coins.Parent = leaderstats

end)

 

Step 5: Save and Test Your Game

  1. Save your work by clicking File -> Save to Roblox As... and follow the prompts.

  2. Click Play to test your game. When your player character spawns, you should see the leaderboard with the Score and Coins stats.

Step 6: Updating Stats (Optional)

To update the stats dynamically, you can write scripts that modify the Value properties of the stats. For example, to increase the score by 10 when a player touches a specific part:

  1. Insert a Part into the workspace and name it "ScorePart".

  2. Insert a new script into the "ScorePart" and add the following code:

 

  1. local part = script.Parent part.Touched:Connect(function(hit) local player = game.Players:GetPlayerFromCharacter(hit.Parent) if player then player.leaderstats.Score.Value = player.leaderstats.Score.Value + 10 end end)

Comments


bottom of page