DataStore prints "nil" as an error message

So I’m making a money system and it tells me nil.

The same thing happens here:

Though in the second example it throws me a lua error and not a datastore error.

What exactly shows in output? It can’t simply just say “nil”.


It can say just nil.

In the second example you declared the set function in local scope which prevents function from calling itself inside the function so luau throws error because it can’t find the function, remove the local keyword when declaring the function.

Still. It doesn’t change the fact that the datastore error is literally nil.

Could it be because there is no money to save?

Nope. I made a few pads which will add money. I walk on these. Leave the game. And then. nil. Even if there was no money to save then it should save 0.

Hm. Maybe you’re not giving the right path. It says plr.Money.Value. Should it say plr.leaderstats.Money.Value?

Nope. The money is supposed to be placed and is placed in the player. And I’m almost 100% sure that I’d give me an error saying that it doesn’t exist.

You missed = at local status, resp pcall(func should be local status, resp = pcall(func

3 Likes

Oh my god thank you so much! I can’t believe I wasn’t able to notice it.

1 Like

Also if you have a return inside a pcall the error message will be the returned value.