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

How to make Leaderboards?

Now, I understand how to make leaderboards for a specific server, but I was wondering how people made leaderboards that are Universal (From server to server). I was thinking about using ReplicatedStorage to store the data, but I'm not sure if that works or not. If somebody could please clarify this for me that would be great.

Thanks! -Dyler3

2 comments

0

You need to use DataStore, but I don't know it well enough to teach it.

0

Me neither... To the wiki!

1 answer

✓ Accepted answer

While I try to figure this out, here's a couple of links that might help:
DataStoreService
GlobalDataStore
DataStoreService (overview & examples)

Extra/Secondary links:
Game/DataModel
OrderedDataStore
Data Persistence
Data Stores Disadvantages in comparison to Data Persistence
I'll edit this as I go: First step: go to the games page (Profile>Manage My Places>Games>Configure) and enable Studio Access to API Services.

Game.Players.PlayerAdded:connect(function(player)
--To create, edit and reference a Data Store:
local DataStore = game:GetService("DataStoreService"):GetDataStore(player)--Finds a DataStore under the name of player, and if it cannot be found, creates a new DataStore under the player's name.
local p = DataStore:GetAsync("points")--returns a value corresponding with the key "points"
local leaderstats = Instance.new("Model")--create the leaderstats
local points = Instance.new("NumValue",leaderstats)
points.Name == "points"
points.Value = p or 0 --if p is nil, points = 0
leaderstats.Parent = player
points.Changes:connect(function(value)
DataStore:SetAsync("points",points)--if the points change, so do the points in The DataStore
end)
end)

2 comments

0

Thanks for the response! I'll look into some of this and see what I can do with it. Again, thanks!

0

No problem. I didn't compensate for limitations, though. I'll have to update my answer later.

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