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

What’s the difference between UpdateAsync or is it better to use SetAsync?

Asked by 5 years ago

I know that when using data stores you can either use SetAsync or UpdateAsync but is either one better than the other?

2 answers

Log in to vote
0
Answered by 5 years ago

There is a previous forum here but I will explain it quickly;

SetAsync() is used for setting the value of a key, in which will overwrite the current existing one and UpdateAsync() is used for retrieving the data from thee key and updating it.

0
Good Explanation! Thx! Cynical_Innovation 595 — 5y
0
bit more info about this - setasync just overrides data but update async allows you to compare the old data with the new data to make sure it's valid. getasync isn't always the most recent data so it's best to validate your data to avoid dataloss which is why uodateasync is better than setasync. Setasync is good when you need to push the data reguardless of what was in there before such as when yo royaltoe 5144 — 5y
0
you're saving the data for the first time. I'll get a link to a post I made about it a few days ago royaltoe 5144 — 5y
Ad
Log in to vote
-2
Answered by 5 years ago

:UpdateAsync and :SetAsync are kind of the same, but :UpdateAsync is useful when there are multiple places that can update a player's data.

Answer this question