DataStoring Problem

yes it does and thats what im trying to fix because when you join the game it supposed to print “DataStored” not that long message which means my data isn’t storing

I even tested it my going in the console and changing my money and rejoining

And now I’m getting a message that says

08:24:25.755 - ScriptNavigationHandler : No script currently available.

But idk if thats part of the CurrencySystem/DataStore

No that’s just a roblox-studio thing.

And I came here about the problem because I spent at least 2 hours trying to figure it out and I can’t figure it out

Can we see where you are doing the player removing event? I’ve seen people have a player removing function and bind to close saving data, which causes 2 requests to be sent, and hence giving this error.

What do u mean??? Sorry for all the question marks it wasn’t letting me send the message because of 30 characters

You said you get the error when you are leaving. So it has something to do with what you do when the character leaves. Do you have a bind to close function that saves data, and a player removing that saves data?

you can try:

Yes and now the script isn’t loading anything at all

Bind to close in datastore is not necessarily to save data. It’s used to delay the amount of time it takes for the server to close. All you really need in your bind to close is just a wait(x). You can chose the amount of time it waits till it closes.

You should also wrap your saving in a pcall in the player removing function

How would I do that exactly???

And now I have another problem

Just delete everything inside of the bind to close function that you have already. And replace it with wait(3). You can change the wait time if you desire. And then for the saving just do pcall(function() and put the setasyncs in there. If you want you can do local success, err = pcall(function() so that it can print error messages for you, if done correctly.

Ok I’ll do that now my stuff isn’t loading

And btw I can’t do the PCALL function cuz it kicked me from the game

And I already have a script that saves and calls the pcall function

pcall(function()
savedData = DataStore:GetAsync(ID)
end)

Ohhh my bad. I misread the use of your bind to close. I don’t believe it has any affect on your datastore, but it could kick the player before the data could save.

Anyways, the reason is because you are writing to the same key 2 times in a row. You should be saving a table instead, or have two different keys, but that’d be more of a hassle. With a table you can store multiple values under the same key.

Is there a way to do that or what

Yes there is. You can look at this to see how you could structure a datastore to save a table. Datastore with tables - #6 by ReturnedTrue