hi scripter, so, ive just made a auto save and leaderboard (on top of screen) But the save does not save... If you want to see it, here you go! https://www.roblox.com/games/722511272/Jumpy-racing-Under-construction But what am I doing wrong?
leaderboard
game.Players.PlayerAdded:connect(function(plr)
local stats = Instance.new('IntValue', plr)
stats.Name = 'leaderstats'
local Points = Instance.new ('IntValue', stats)
Points.Name = 'Wins'
end)
OrderedDataStore AutoSave
local DSService = game:GetService('DataStoreService'):GetDataStore('Hamburger223232')
game.Players.PlayerAdded:connect(function(plr)
-- Define variables
local uniquekey = 'id-'..plr.userId
local leaderstats = Instance.new('IntValue', plr)
local savevalue = Instance.new('IntValue')
leaderstats.Name = 'leaderstats'
savevalue.Parent = leaderstats
savevalue.Name = 'Wins'
-- GetAsync
local GetSaved = DSService:GetAsync(uniquekey)
if GetSaved then
savevalue.Value = GetSaved[1]
else
local NumbersForSaving = {savevalue.Value}
DSService:SetAsync(uniquekey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:connect(function(plr)
local uniquekey = 'id-'..plr.userId
local Savetable = {plr.leaderstats.Wins.Value}
DSService:SetAsync(uniquekey, Savetable)
end)
I hope you can help me out! thanks! good luck with other scripting!
-Gamer_io

1 comment
This is not an ordered data store this is a global data store.