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

Reasons for failure pcall on UpdateAsync()?

Asked by 8 years ago
Edited 8 years ago

In solo mode(not online mode), does pcall return false with :UpdateAsync at all times?

1local success, message = pcall(PlayerData:UpdateAsync(key, function(oldValue)
2    return Data
3end))

This could mess up my datastore system where I forceload any missing data and try to revive the player's data.

It states it's a failure but the data is successfully stored..

1 answer

Log in to vote
0
Answered by 8 years ago

You are pcalling the value returned by PlayerData:UpdateAsync, not the function call itself. To correct this, simply create an anonymous function for use by pcall:

1local success, message = pcall(function()
2    PlayerData:UpdateAsync(key, function(oldValue)
3        return Data
4    end)
5end)
Ad

Answer this question