Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make Leaderboards?

Asked by
dyler3 1510 Moderation Voter
9 years ago

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

0
You need to use DataStore, but I don't know it well enough to teach it. Perci1 4988 — 9y
0
Me neither... To the wiki! aquathorn321 858 — 9y

1 answer

Log in to vote
1
Answered by 9 years ago

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)
0
Thanks for the response! I'll look into some of this and see what I can do with it. Again, thanks! dyler3 1510 — 9y
0
No problem. I didn't compensate for limitations, though. I'll have to update my answer later. aquathorn321 858 — 9y
Ad

Answer this question