I need help on how to add a leaderboard
COMMUNITY QUESTION
How do I add a leaderboard?
1 answer
Yea here's a good link for you to reference next time.
Here is what the code looks like:
local function onPlayerJoin(player) -- Function adds a folder to the player object: (player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats" -- the folder is always called "leaderstats"
leaderstats.Parent = player -- then the folder is added to the player object: (player)
--Here is where the stats are named and given values
local gold = Instance.new("IntValue")
gold.Name = "Gold"
gold.Value = 0
gold.Parent = leaderstats -- They are always parented to the (leaderstats)
--You can add more stats
--e.g. experience; points; time played; etc..
end
game.Players.PlayerAdded:Connect(onPlayerJoin)
(If you're going to copy this code, make sure to press "View Source" to copy it correctly, you'll need to make sure this is pasted into a normal script that is parented to the workspace or ServerScriptService)
This discussion is preserved as it was. New answers, comments, and votes are closed.
