0

# how to make a datastore with leaderboard?

i cant make the datastore keep the leaderboard values ive been trying all the things i could think of and i even tried watching videos

0
You need to use a ordered datastore MikkelCircled 0 — 12d

0

If you want to know more about ordereddatastores go here: https://developer.roblox.com/en-us/api-reference/class/OrderedDataStore

0
Edited 11 days ago

If you need to save more and don't know were to add the extra bits to save more data comment and i'll help you when i'm online!

Ok so I edited it. All of the lines of code with "----" or have "StatName" or both instead of an actual StatName at the end or in the middle of line of code are the example lines of code to add more values to save in the datastore. I hope this helped! If you can mark this answer as the "correct one" i'd appreciate it a lot :) If you still need help on how to figure this out comment back [although i think you should already get it since this is pretty clear]

local ds = game:GetService("DataStoreService"):GetDataStore("SaveData")
wait()
local plrkey = "id_"..plr.userId

local GetSaved = ds:GetAsync(plrkey)
if GetSaved then
save1.Value = GetSaved[1]
save2.Value = GetSaved[2] ----
else
local NumberForSaving = {save1.Value, save2.Value} ---- ", save2.Value"
ds:GetAsync(plrkey, NumberForSaving)
end
end)

game.Players.PlayerRemoving:Connect(function(plr)
end)

0
yes please that would bee very helpful if you can help me add more values Luvaking 0 — 11d
0
Ok, let me add more example values so you can understand how to save more values Nitrolux200 49 — 11d
0
I edited the message, hope it's clear now! Nitrolux200 49 — 11d
0
local DataStoreService = game:GetService("DataStoreService")
local PointsStore = DataStoreService:GetDataStore("Nameofyoursave")

local SavedPoints = PointsStore:GetAsync(Player.UserId)

PointsValue.Name = "Money"

if SavedPoints ~= nil then
PointsValue.Value = SavedPoints
end

PointsValue.Changed:Connect(function(NewPoints)
PointsStore:SetAsync(Player.UserId, NewPoints)
end)
end)


this is what i use