Save/ Load problem

I watched the gdevelop tutorial but still no luck

I believe the 1st line should be
Save ToJSON(GlobalVariableString(MinableCount)) in “save” of storage “save”

It needs to be converted to JSON first. To convert a number variable to a string, you can use ToString(GlobalVariable(VariableName)) or GlobalVariableString(VariableName)

It is showing this

and just to clarify i am using a structure global variable

I’m sorry. You do need

GlobalVarToJSON(MiniableCount)

I forgot that function only takes the variable name and it’s the function with the scope.

https://wiki.gdevelop.io/gdevelop5/all-features/common-conversions/reference/


still nope not working

Tip: you should always use the condition to check for existence of storage if you don’t want to retrieve null (0) values to your variables when no storage exists.

About the events, there is no reason why they would not work.

just as a quick question the temporary variable needs to be in number or text form?

Do you mean “tp”? I think it wont matter, the Load action will overwrite it anyways, but it should be a text variable.

About the one in “GlobalVarToJson()” it can be anything.

can it be a structure?

As I mentioned below:

but still it is not working i don’t know what to do

Its probably working, can you open with the debugger and check the global variables?

This works for me.

You might need to delete the storage. It could have invalid data stored in it from the previous code.
Try this at the very beginning and then remove or disable it.
image

Storage can be tricky. Once you save it, it will override any of the variables default values the next time you load it. If you later add to the structure in the setup scene, you’ll have to delete the storage or update the variable after it’s loaded from storage or it will ignore the change and just keep loading and saving the old value.

Still not working i tried that too
i even checked the debugger and it shows the global variable having the values but doesn’t shows in the next scene

Can you take a screenshot of how are you trying to access the childs of the structure? It should be this format: StructureName.ChildName OR StructureName[“ChildName”]

you mean in debugger?

No, a screenshot of the expressions that you use to try to access the childs in the next scene. Maybe you are doing it the wrong way causing it to acess a unexistent variable.


this the only thing i am using to access the save file

Can you explain how do you know that the variable is not being loaded?

before adding
image

so i added the values and even after changing scenes it is still showing same

image