[SOLVED] Global Variables and storage not working

Greetings forums,
I’m trying to save a global variable to storage, which will then be loaded in once the game boots back up.

I read that for convenience, I can save tons of values in a single storage unit, so that’s what I’m doing here. I’m saving the global variable to StatusBar, which already stores another group to have a variable that can call everything at once. Once the game is loaded, I want the text object (Seen in second screenshot) to update the new data.
For some reason, this is not working. I even tried saving it as a value instead, putting it in a scene variable, and then making the global variable that counts the collectibles change to what the scene variable is, and even that didn’t work.
Does somebody see my mistake?

You’re trying to parse Text as JSON.

You’re storing a totalCollectible variable to CollectibleAmount, You’re then loading it back in, reading it as text (not JSON) into CollectibleAmountGlobal.

You’re then trying to Parse it as a JSON String, but it’s not stored as a json string, so it won’t parse correctly.

If you want to do that, you need to convert it to JSON when you store it in storage first.

Oh, my bad. Fixed it now. Thanks

1 Like