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
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)