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

what is the difference between :UpdateAsync and :SetAsync?

Asked by 7 years ago

is updateAsync good for autosaving and/ or for preventing glitches?

1 answer

Log in to vote
2
Answered by 7 years ago
Edited 7 years ago

SetAsync is generally prefered if the previously saved value is not important e.g. you're saving the player's position in a world.

UpdateAsync is prefered when the previous value is important e.g. you're adding 10 coins onto the player's Coins stat.

The reason is that UpdateAsync will make sure that the previous value is correct, while GetAsync may return a cached value, meaning that SetAsync would set it based on that cached value rather than the actual value.

Ad

Answer this question