Player Losing data when leave and enter quickly

I am facing an issue that when a player enters my game and exits quickly, he loses all progress

This player had 2000 money and some power points, and when he quickly left the game and rejoin he lost all data. ( This happened because he entered quickly and the datastore was not loaded)

how do i solve this problem?


--some stuff above ^ (example)
for i, ld in pairs(player:FindFirstChild("leaderstats"):GetChildren()) do
		Dictionary.Leaderstats[tostring(ld.Name)] = ld.Value

local Success, ErrorMessage = pcall(function()


local Success, RecievedData = pcall(function()
		return StatsDataStore:GetAsync(player.UserId)
	if Success and RecievedData ~= nil then
		RecievedData = httpService:JSONDecode(RecievedData)

what i’m doing wrong?

1 Like

Don’t save if the stats are a new account. This prevents issues like these and saves some resources.

1 Like

but how can I keep the progress saved, since if the player is a new player he needs the data to be saved

If a new player has no data there’s nothing to save. If you have 0 wins, 0 coins, no items, etc. then why save?

1 Like

I had same problem today in Studio. I started game and fastly stopped. And then my data was wiped.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.