Datastore removes leaderstats bug

Oh, umm, i was thinking when if the script had "", you will do: '' and if the script had '', you will do "".

1 Like

I changed the local script to what you said and there’s no error but the leaderstats still aren’t loading

Basically WaitForChild does something similar to this

function Instance:WaitForChild(childString, optionalTime)
       local startTime = DateTime.now().UnixTimestamp
       local child = self:FindFirstChild(childString)
       --
       while child == nil and (typeof(optionalTime) ~= "number" or (DateTime.now().UnixTimestamp - startTime) < optionalTime) do
            child = self:FindFirstChild(childString)
       end
       --
       return child
end)
1 Like

Where did you create the leaderstats? In the local or server script

server script in the setupPlayer function

Hmm, I see, we can fix that easily, however. I highly recommend you to switch up your datastore script, and use ProfileService, search it up on DevForum, it is easy to learn and should be used almost always

1 Like

I understand what you mean, and you are correct, i thought u meant another thing

If you ever wish to make a string with quotes, just do [[]]

ive heard of that, i’m still confused tho. i followed this tutorial as im not to advanced with scripting yet: Saving Player Data with Data Stores! Roblox Studio Simulator Guide Episode 2 - YouTube

Because it will make your code much more readable and will do things that you are already trying to do, like autosaving.

I highly suggest you to do so not because your script can be fixed but because in my personal experience I used to waste a lot of time in datastores scripts until i found profileservice

1 Like

I will send you through dm an example

1 Like

its fine, but ide rather stick to the tutorial as im trying to improve

Hi!

I see that you have trouble with saving/loading data. I would recommend looking at this thread, where I give a direct solution to your problem. :slight_smile:

1 Like

what script tho and at what part?

ChangeValue function, localscript

1 Like

and the old error is back again

don’t bother anymore, i give up

Hi!

Please take a closer look at the thread I sent you. It is almost a plug-and-play reply. :slight_smile:

1 Like

i have looked, however its not loading or saving data, its the fact that the leaderstats have been quote on quote “Deleted”.

im also trying to keep the same code and not use any others like datastore2 or profile

If you give up, in 3 months you will have the same scripting knowledge as right now, and maybe you would have wished not to give up

Try:

  • Printing before the error, what is leaderstats? What is …?

  • Rewrite your code?

Try things, but don’t give up, you will sooner or later find the error

1 Like