If you don't want to help, don't help, for those who want to help; try your best :), and if you can't dont leave an answer.
It's supposed to work like a normal datastore, but obviously things never work for me so there was something wrong; When my friend joined, i saw his old datastore go to his for a split second and then it went back to zero for a reason?
local DataStoreService = game:GetService("DataStoreService") local StatsData = DataStoreService:GetDataStore("Savers") local key = "Player_" game.Players.PlayerAdded:Connect(function(player) local sucess, errormessage = pcall(function() local retrievedData = StatsData:GetAsync(key .. player.UserId) local leaderstats = player.leaderstats leaderstats.Cash.Value = retrievedData[1] leaderstats.Power.Value = retrievedData[2] leaderstats.Rebirths.Value = retrievedData[3] end) end) game.Players.PlayerRemoving:Connect(function(player) local leaderstats = player.leaderstats local sucess, errormessage = pcall(function() StatsData:SetAsync(key .. player.UserId, {leaderstats.Cash.Value, leaderstats.Power.Value, leaderstats.Rebirths.Value}) end) if sucess then print("Was a succesfull data store!") else warn(errormessage) end end)
Datastores may fail to work sometimes, so you need to keep saving/loading data until it's successful.
local tries = 0 -- For debugging if sucess then print("Success") else while not sucess do print("Error: ", errormessage) sucess, errormessage = pcall( -- GetAsync/SetAsync function ) tries = tries + 1 wait() -- Prevent a script timeout error end end print("Attempts to save/load: ", tries)