Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by
Robowon1 323 Moderation Voter
4 years ago

Missing a bracket,

change this:

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

to this:

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

Answer this question