SetAsync DataStore not working

Okay, in the screenshot you can see my script which should theoretically save the IntValue when the player leaves the game. I need this IntValue to be one for the whole game, that is, if a player changes it, the other players will see it. The problem is that when I click on the button, it changes the IntValue, but in the script, if I put it

to print, it will say that the IntValue is 10, although I’ve done clicks and it should be 5. Also, for some reason, the second print just doesn’t execute. You can see it all in the screenshot. If anything I told manually beforehand that IntValue = 10. And the idea is that the players will click on the button and it will change for all players and also save. HELP PLEASE!

Your click script is a local script, client-sided scripts wont replicated meaning your number isn’t changing. Try putting the click code into a server sided script.

Also your second print isn’t firing because the SetAsync is overwhelmed try adding a wait() under it.