I suggest you use a dictionary rather than global variables for anything that needs to be saved. Saving/loading dictionaries is easy with the dictionary.asJson expression.
Alternatively, a bit more messy, you can use system save/load to store the entire state of your game. I say it’s more messy because it will restore the state entirely, not just the variables. So you’ll need to handle the states of instances, current layout, etc when loading.