Code:
local DS = game:GetService("DataStoreService"):GetDataStore("Data")
game.Players.PlayerAdded:Connect(function(plr)
wait()
local plrkey = "id_"..plr.userId
local savevalue = plr.leaderstats.Money
local savevalue2 = plr.PlayerStats.Sitem
local savevalue3 = plr.leaderstats.Rebirths
local GetSaved = DS:GetAsync(plrkey)
if GetSaved then
savevalue.Value = GetSaved[1]
savevalue2.Value = GetSaved[2]
savevalue3.Value = GetSaved[3]
else
local NumbersForSaving = {savevalue.Value, savevalue2.Value, savevalue3.Value}
DS:GetAsync(plrkey, NumbersForSaving)
end
end)
game.Players.PlayerRemoving:Connect(function(plr)
DS:SetAsync("id_"..plr.userId, {plr.leaderstats.Money.Value, plr.PlayerStats.Sitem.Value, plr.leaderstats.Rebirths.Value})
end)

7 comments
Use code block.
Ok
You should probably use pcall on set async
where?
Is this your full code?
Besides, on line 8, it should be local GetSaved = DS:GetAsync("Money",plrkey) and you should repeat this for the Sitem and rebirth
This is my full code