Help me fix this While Loop?

I’m trying to run a loop while the character is in the air that ends when the player stops falling. This compiles fine but the game recognizes it as an infinite loop. I’m not a coder so I’m having trouble with figuring out why this isn’t working, thanks!

normal loops basically run between frames, they do their thing until its done (more accurately, they stop everything else until the loop completes). this could mean they do it 100-1000 times or infinitely between each frame. the engine recognizes a infinite loop as something that loops X times, where X is just a high number. i dont remember the number exactly but imagine its a few thousand. as you can see this quickly can cause a infinite loop and further problems. your basic while loop just isnt designed for this type of situation.

now i dont know the specifics of your script and situation but im sure theres another way to script your desired behavior to get it to work.

In addition to ThompsonN13’s comment, which pretty much already explained why you are getting a endless loop, if I am assuming correctly, I reckon you are trying to do something when the character lands after you start that montage. The name also gives the impression the montage only happens while in air.

In which case, I recommend you use the “On Landed” event (called everytime the character lands after falling/jump). What I would do is setup an event dispatcher, and call it with the On Landed event. That way, the moment you start your montage the only thing you have to do is bind an event to the dispatcher you just created and use that event to signal the end of your fall (you may want to unbind the dispatcher then too, otherwise the function will get called on other landings as well).

On Landed worked perfectly! Thank you for the explanation and responses.