Here are my scripts. If you find any errors can you correct them in the answers? Thanks leaderstats script- game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("Folder") leaderstats.Name = "leaderstats" leaderstats.Parent = player
local cash = Instance.new("IntValue")
cash.Name ="Cash"
cash.Value = 0
cash.Parent = leaderstats
end) DataStore script- local ds = game:GetService("DataStoreService"):GetDataStore("SaveData") game.Players.PlayerAdded:Connect(function(plr) wait() local plrkey = "id_"..plr.userId local save1 = plr.leaderstats.Cash
local GetSaved = ds:GetAsync(plrkey)
if GetSaved then
save1.Value = GetSaved[1]
else
local NumberForSaving = {save1.Value}
ds:GetAsync(plrkey,NumberForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr) ds:SetAsync("id_"..plr.userId,{plr.leaderstats.Cash.Value}) end)

2 comments
No it doesn't work
What error are you experiencing and is this placed in workspace or ServerScriptService?