What is the difference between SetAsync and UpdateAsync?

Well I saw several other posts but I didn’t understand any

UpdateAsync updates a value (already existing value)
SetAsync sets a value

Most basic explanation of the difference.

2 Likes

Can you give me examples about UpdateAsync?

I have a value in a game that can only go up.

  • That’s when you use IncrementAsync()

I have a value in a game that can change (like coins, for example)

  • That’s when you use SetAsync()

Most people use IncrementAsync() in the last case, as it is somewhat more secure.

I have a string value in a game that can change (play time as example ?)

  • That’s when you use UpdateAsync()

There are also articles on the Roblox Developer Hub, you can read more about this here.

2 Likes

That should also be a number, why would you store time as a string?

2 Likes

I gave it as an example, the first one that came to my mind, I forgot to change the string to number