Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

UpdateAsync() will not save my player data and I don't know why?

Alright so I tried making a game that saves progress with a value called "XP". Here's the script that saves the player's progress with their XP when they leave the game:

game.Players.PlayerRemoving:Connect(function(client)
	print("removed")
	local success, err = pcall(function()
		dS:UpdateAsync(client.UserId.."-XP", function(oldValue)
			local newValue = client.leaderstats.XP.Value or 0
			print("saved")
			return newValue
		end)
	end)
end)

"removed" was printed, but nothing else seemed to work. I also made it to where the script that retrieves these values when a player joins prints out what values they got. It printed out "nil" (I can only assume it's because this I'm having trouble with isn't saving the values). Please let me know on a fix if you know one!

Thanks.

1 answer

Missing a bracket,

change this:

dS:UpdateAsync(client.UserId.."-XP", function(oldValue)

to this:

dS:UpdateAsync(client.UserId.."-XP", function(oldValue))

This discussion is preserved as it was. New answers, comments, and votes are closed.