UpdateAsync() not working

game.DataStoreService:GetDataStore("UD"):UpdateAsync("Usernames", function(oldvalue)
		     local newtable = table.insert(oldvalue, "Rolu")
		     return newtable
end)

this does not seem to be working, its meant to insert a username into a username database then update it, but it isnt changing it, api services are allowed. any help?

Try logging oldvalue when this function is run and see if it is returning nil.

It replies with {}, which is as expected as they is no usernames added to the table as of now. any help?

Nvm, i solved it, you need to make it like this (dont return the change, return the actual value.)

game.DataStoreService:GetDataStore("UD"):UpdateAsync("Usernames", function(oldvalue)
          local editable = oldvalue
		     local newtable = table.insert(editable, "Rolu")
		     return editable
end)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.