What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have changed the name of the datastore as to make a new one, but the same problem kept occurring. I think the issue might occur because I changed the values in the default playerData assigned to new player: the damage and health instances used to say “0” before I figured out what I wanted them to be.
If that was the issue, though, I would have expected it to disappear when I made a new database with the new values from the start, but it didn’t.
Are you changing the value of the damage instance? It seems the values on sessionData are updated only when the instance changes value rather than updating it to a default value (ex. 0) when you create it.
Yes, I change the damage instance when players upgrade their stats. And as I am testing the datastore script I change the value by clicking a button, but the sessiondata doesn’t seem to notice
When I use it, the game prints out that the damage is changing (line 140) and tells me the new value, but when I end the test and start is up again, the game print nil again
Okay I tested it. When I change the damage on roblox and return to studio, the damage seem to be saved on the datastore. Could this be an issue that only I will experience, because I started out by typing the wrong values on the default playerdata?
If the version on Roblox is the same as the one in Roblox Studio then no that’s not the issue, it’s most likely something to do with Roblox Studio not registering PlayerRemoving/BindToClose properly. When you leave the game on Studio, do you see the prints from your playerLeaving function?