:UpdateAsync() only sometimes works

I tested it ingame with 2 accounts. The only time that data is saved is when they are in the same server. When both Account 1 and 2 are in a server, and Account 1 leaves and rejoins that same server, the data is saved. But if both Account 1 and 2 leave the game and rejoin a new server, the data is set as default.

Add task.wait(30) to the BindToClose function

BindToClose needs to yield to prevent the server from shutting down

I’m still getting the same results even after adding task.wait(). The output doesn’t print any errors and it seems like the :UpdateAsync function is returning the new value. But when I rejoin, the data isn’t saved.

I had the time to thoroughly look over my code and found out that the problem was that I had a recurse function which checked to see if new data is added to the player’s data, but it also changed the values in the table. And :BindToClose() also helped with saving the last player’s data. Thank you everyone for your help!

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