Repeat Function with global variables

i am trying to use the built in REPEAT event, and use a global variable to define how much it has to be repeated. but gdevelop acts as if the variable would be equal to 0.

the repeat function is supposed to create [global variable] times and object. for example if the global variable is equal to 5, create 5 instances of the same object

instead, it spawns 0

pls help, I’m desperate

Hi, two things come to my mind that could cause this problem:

  1. How do you initialize the global variable? Did you set it through the project manager? If so, it should be available in all your scenes from the beginning. If it is initialized in a specific scene, this scene has to play first to have the variable available in another scene.
  2. Do you use the right syntax for calling the variable in your Repeat-event? It should be: GlobalVariable(<your_variable>).
1 Like