Why odes my Data Store not work

Did it work?

zzzzzzzzzzzzzzzzzz

No.

zzzz zzzzzzz zzzzzzzzzzzzzzzz

And you tested it in an actual Roblox game too right?

Yes, I did that.

zzzzzzzzzzzzzz

In another script try putting this:

game:BindToClose(function()
	if game:GetService("RunService"):IsStudio()then 
		wait(6) 
	else
		wait(35)
	end
end)

I found this script off another page on the devforum
The game could be closing too quickly before saving data
Here it is if you want to check that thread out

I found out something interesting although I don’t if it helps.
The part of the script with the CharacterAdded part teleports the player to the Checkpoint with the name of the Value of the leaderstats.Stage.Value.
So I went and added stage.Value= 1 when creating the leaderstats folder.
And now when i load the game I get an error because the game wants to teleport me to the Checkpoint with the Name 0 despite me setting the Value in leaderstas to 1 (It cant be 0).
So my conclusion from this is that the game doesn’t save the Data properly so it loads the number 0 althoug like I said early the Value can’t be 0)

Dont know if you understand what I mean.

Yea I see what you mean
No idea how to help you because I don’t know how your game is organized
There could be some other script that is countering this
Have you tried just rewriting the script entirely?
Would recommend using two scripts instead of just one where one script makes the folders and values and the other one is the one that saves your data
You could also just make another script entirely that teleports your player

1 Like

I guess this is my only option. And think the idea of just making 2 scripts would be much better because it would make everything clearer. Thanks for your help and your time

No problem
Glad I could help out! :slight_smile:

Good luck on your datastore & your game

Update after rewriting the Scripting and splitting it into 2 Scripts: IT WORKS NOW
I still don’t know what the problem with the original Script was but that doesn’t matter now.
Again, THANK YOU FOR YOUR HELP

No problem!
Glad it all worked out :slight_smile:

1 Like