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.
Missing a bracket,
change this:
dS:UpdateAsync(client.UserId.."-XP", function(oldValue)
to this:
dS:UpdateAsync(client.UserId.."-XP", function(oldValue))