Is it just me or are data stores not working in Studio

I am doing some testing and fixing in Studio, and I saw that changes are not being saved. I tested the issue in a live game, and the changes did save just fine. I started this project a long time ago, and the data stores worked fine.

Also, I just checked, and the game failed to read from the data store, so now the game thinks I’m a new player because it saved the game that way (no big deal, it’s just for testing).

Is anyone else is having this issue in Studio?

Also, I do have that API box checked.

6 Likes

Are you testing this with Studio? Or in your published Roblox game? For me, DataStores work well when I publish the game to Roblox and test it.

1 Like

Studio does save data, but most of the time it fails. If it doesn’t work in game then that’s a scripting issue. The only time a datastore fails is when many games have data unable to load.

So, no, this doesn’t happen to me.

I tested in studio and in a live game. The live game worked fine.

That happens to me too - that’s why when I test a DataStore, I always publish the game to Roblox and check the API box, then proceed to test it.

1 Like

Are you the owner of the place?? Roblox has a rule which only the owner of the place can do this, anyways sometimes roblox studio can’t run data stores very well try it again after 24 hours it might be fixed

1 Like

Yes, I own it. It is my place. I had to type this extra stuff for the 30 characters.

Generally, servers in studio shut down before saving can occur (especially in solo play). My recommendation for testing datastores in studio is to run a local test server and leave with the player before shutting down the server. That way, the methods will have a chance to save the data before the server shuts down. You cannot use BindToClose in studio, so that’s why this is the solution I recommend. This was an issue someone I helped recently had and it’s easily resolved by testing in the way that I described.

2 Likes

Whats going on is that you have Studio Access to API Services disabled. You have to enable that first in order to access DataStores from Studio.

Nope they dont.

3 Likes

Thanks, but it’s already enabled. It just doesn’t like to work sometimes (works in game though).

1 Like

Actually, they do. I have done explicit testing.

1 Like

My ‘explicit’ testing conludes that it always saves, no matter what if its Solo Play or not.

As I have corroborating evidence from multiple other developers, I can only conclude that your successes have been a fluke. In solo play testing, the server will sometimes shut down before the save function can take place. This is not always the case, but it sometimes is.

1 Like

All the times I’ve done it (which all added up is hundreds of times) they all worked, so its not a fluke.

Not sure if its a PC issue or not, but it works just fine for me.

For me studio does not save all the time when I leave play solo (it does save occasionally). If my game try’s to save while I’m in play solo it works. Just when I leave it doesn’t seem to fire the player.playerRemoving event.

I’ve later concluded that the DataStore API will indeed not save when Solo Play testing. I’ve realized that my tests that I’ve done had a wait() whenever a player leaves to save the players data, so my tests were indeed at fault here. Sorry for the excess and unprofessional behavior I’ve been displaying about that throughout.

So in the OP’s case, they would have to add some sort of delay before saving the players data if they want to have data save from Roblox Studio. Roblox servers save even without the delay so even if Studio wouldn’t save the data, at least actual Roblox servers will.

The OP can also use game:BindToClose() to save all players data but I doubt this will work. My tests concluded that it did but it isn’t always the same for everyone.

4 Likes

it doesn’t save because of how fast the player leaves the game when you stop the simulation in studio which means the PlayerRemoving function wasn’t even fired to begin with, if you kicked the player from the game, the PlayerRemoving function would then work, try kicking the player instead of stopping the simulation for the game to have the chance of detecting the player leaving and saving their values.

game:bindToClose() would probably be easier then kicking the player instead of having them leave normally

It worked for me sometimes. However, about 90% of the time it do not work

Make sure you have a BindToClose function along side the PlayerRemoving. Something I noticed is that the server doesn’t always Disconnect fully in studio (or something like that), sometime the server would say disconnect (that’s when it would work) and sometimes it wouldn’t. If you use BindToClose it should always work.

1 Like