UpdateAsync not returning a value

According to the Roblox wiki UpdateAsync is supposed to return the updated value of the data for the given key

However for me it’s returning nil instead

Here is my code:


( getRandomString does not yield it’s just a basic random string generator)

This is the output:
Screenshot 2022-01-21 at 19.17.38
So the data store itself definitely isn’t nil as we can see from the first print, meaning it’s definitely UpdateAsync not returning the updated value of the data store

Is there something I’m doing wrong here, or perhaps a misunderstanding on my part?

Possibly not, Roblox is currently down and DataStoreService may not be working as expected.

Roblox DataStores are struggling at the moment, that may the issue.
image

I’ll check later, but I was having this issue before Roblox went down

2 Likes

UpdateAsync effectively just returns whatever its handler function returns (which is also what data is ultimately saved). Your code modifies the table is receives but does not return it back to UpdateAsync; as a result, the save attempt is aborted and the function returns nothing.

1 Like

Ah thanks, works now. The wiki kind of misled me saying UpdateAsync itself will return the updated value, it should say it returns the handler function.

1 Like

Add return currentTable to the anonymous function passed as the 2nd argument to the :UpdateAsync() instance method.