Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How am I supposed to make a leaderboard?

I want to make a leaderboard but don't know how to. Is there a way to do that in the tools or do I have to make the script myself?

1 comment

0

scripting helpers is not a request site. but you can parent a value to starterplayer and name it leaderstats. each value you parent to leaderstats shows up on the leaderboard

2 answers

So, leaderboards do need scripting, if you want to script a leaderboard make sure you know 'DataStoreServices'. Because leaderboard is nothing without it. So, to create a leaderboard:

  1. Add a Part in workspace and scale it to your preferences.
  2. Add SurfaceGui and Frames to the part. [Make sure it isn't covering the whole part, it's for showing player name and data]
  3. If you have added a Frame, in which all your contents of player name and player data is there, add UIGridLayout in that. [This will make sure when cloning the Frame, the frames don't overlap]
  4. Lastly, add a Server Script in ServerScriptService and add your datastore and cloning frame scripts.

Please Upvote and lemme know if it helps!

In the ServerScriptService Type the following:

game.Players.PlayerAdded:Connect(function(plr) --Player joined Event
local stats = Instance.new("Folder") 
stats.Parent = plr --Adds a folder into the player
stats.Name = "leaderstats" --Names it

local Cash = Instance.new("IntValue")
Cash.Parent = stats --Adds a value in the folder,thats the currency
Cash.Name = "Cash"
end)

Remember:It is a server script,not local!

and we can also do an auto-currency adder!

add after the "Cash.Name":

while true do
wait(1) --Add a wait for the loop not to crash the game
for i, players in pairs(game.Players:GetPlayers()) do --Gets All Players
players.leaderstats.Cash.Value = players.leaderstats.Cash.Value + 10 --Adds Cash
end

Hope it helped!

2 comments

0

well,this is not a global leaderboard,if you want it then tell

0

Also it doesnt saves when the player leaves

This discussion is preserved as it was. New answers, comments, and votes are closed.