my data doesnt save when i rejoin
this is in a seperate script from the leaderstats
local datastore = game:GetService("DataStoreService"):GetDataStore("SavaData") game.Players.PlayerAdded:Connect(function(plr) wait() local plrid = "id_"..plr.UserId local save1 = plr.leaderstats.Coins local GetSaved = datastore:GetAsync(plrid) if GetSaved then save1.Value = GetSaved[1] else local NumberForSaving = {save1.Value} datastore:GetAsync(plrid, NumberForSaving) end end) game.Players.PlayerRemoving:Connect(function(plr) datastore:SetAsync("id_"..plr.UserId{plr.leaderstats.Coins.Value}) end)
I believe that your data isn't saving because the server shuts down before SetAsync() can be called (assuming you are the only person testing). Try using game:BindToClose() so that the server gives itself time to save everything before it shuts down completely.
For example:
game:BindToClose(function() --here you would loop through all players and save their data end)