When saving data using UpdateAsync, it is typical to use the following code:
local success, err = pcall(function()
pointsDataStore:UpdateAsync(playerKey, function(oldValue)
local newValue = oldValue or 0
newValue = newValue + 50
return newValue
end)
end)
The following line makes it so that if there is no saved data for the player, it is set to 0.
local newValue = oldValue or 0
My question is, is it possible for UpdateAsync to somehow think that the player has no saved data, and therefore set it to 0 even though the player already had some data?
If UpdateAsync fails, will it think oldValue is nil and set newValue to 0, or will it cancel it and not overwrite anything?
If it can overwrite the data as I explained, how would I avoid it?