Problem with data store

Why does my datastore only save data half the time? I am using evaera’s promise module to attempt to save data when the player leaves and joins when Im testing in studio it only saves data sometimes. Heres my player leaving code;

local player_removed = game.Players.PlayerRemoving:Connect(function(p)
	return promise_class.new(function(resolve, reject, on_cancel)
		local player_stats = get_stats_table(p) --just a function that returns a dictionary of names and values e.g ['money'] = 5.
		local player_id = 'Player_'.. p.UserId --e.g "Player_1234"
		
		resolve(data_store:SetAsync(player_id, player_stats))
	end)
	:andThen(function()
		warn('saved data successfully!')
	end)
	:catch(function(err)
		warn('uh oh something went wrong when setting the players data here: ')
		warn(err)
	end)
end)
1 Like

Probably because third party resources/modules are less reliable than the official ones.