How to use Global Variable Code Blocks

Last updated: March 16, 2025

This doc will explain what and how to use the set global variable --- to --- and get global variable ---. you can use this information to make puzzles and fun things for your maps! Don't worry, there will be some examples to practice ideas on where you can use them!
  1. The Set global variable -- to -- creates like a box. A box you can store any information inside, like numbers, and use it later in your code.
This is the maker

  1. The Get global variable -- is like grabbing that box we made and telling whatever code we put it in, to use the information inside
This is the box

**Where can we use these blocks? Here's where you might need to use it: **

  1. Lets use the Set global variable to -- and make our "box". Place an At start from Event then our Set global variable to -- from variables. In the Key, place whatever naming you want to in there. It's like labelling your box so you know which one it is! in the Value, enter what you'd like. In this case it is "0" for just empty. And that's our box!

  2. Now lets use our box in code. 1 way you can use it, is if you put a 1 plus block inside the Value of a Set global variable to --, block and then place a Get global variable -- in the first 1. This basically tells the code to add 1 value to our box when it is interacted with.

  3. Another place you can add it, is placing it inside a if value equals --- then block and putting how many number values until our box is full and triggers another action. Like saying "when the value in this box reaches (2 in this example) send the order to make stuff happen!

That's global variables! What will you create with it?

Was this article helpful?

Thanks for your feedback!