Datastore not working

I’m trying to make a Datastore for my game but it’s not saving in studio, I have http requests
and api services on, please help.

image

Any errors or anything? If no you should know that in ROBLOX studio the function that was Binded to Close will execute before the function that was binded to PlayerRemoving, as the server will close first. Test this in an actual client before

There are no errors in the dev console.

Well then read the latter, it most likely is that that is causing the issue

So you’re saying it starts with the bottom?

No, if you read it carefully you would have understood that the server on studio will close before player removing can be fired

How do I fix this though, that was my question.

Test it on the ROBLOX Client, not in studio, anything that relies on precision closes is always broken in ROBLOX Studio

This guy im watching did it in studio and it worked for him with the same exact script.

It’s very RNG based, it will sometimes come first, or the other way, most of the time it’s the latter

Thanks, ill try it later in the ROBLOX client.

It seems it’s not saving because there is no data to save. I don’t see you saving the data when the player leaves, hence why nothing is being saved and nothing can be retrieved.

You, Sir, clearly haven’t looked at the Image, as he is literally binding a SetAsync to PlayerRemoving, unless you are referring to binding to Close

I missed that. If you want to effectively save data, I suggest you put the data in a table.

Test the code in Roblox Studios client first. It should work there, there is a thing with Studios that sometimes have trouble with Data scripts. I tested this script in my studio but with different saves (Shouldn’t matter how many) and It worked fine once I ran it in a Roblox client.

One thing I highly highly reccomend is you should always wrap all set async update async and get async in Ocala. These functions will error sometimes and currently you have no way of catching that, and people will lose data.

To do so, you can loop about 5 times ish(I find that to be best) and call the function inside a pcall, and if it was successful break the loop and continue.

You would have to add a WaitForChild for all of the “save1-4” lines. Also, why are you trying to get a sync again after you have found out they have no data, and then not trying to use it at all if they do have data? Are you trying to set a sync instead and just accidentally wrote get a sync? I think that you are since you are using two arguments instead of one. Get a sync only allows one passing argument, which is the key. You are trying to put in two arguments instead. I also recommend you open the errors tab.

There is no errors though, I checked already.

For access to the data you need to have the API enabled but you can’t save on the studio (i never can’t)
Personally im using RunService:IsStudio so, i don’t save when im on studio this is stoping the problem for me

Oh I save on studio just fine. Just have API services enabled, publish and it should work eventually.