Infinite While Loops

I have looked at some of the other questions about infinite while loops and they all just say to not use a while loops because you can do something else. I am making a game where you can slam down on the ground and when you hold down a button it charges up your gravity speed and then you eventually fall. I have this code to accomplish that:

Whenever the button is pressed, You check to see if you are indeed in the air and make sure that slam is not already on. Then you stop the movement so that you stay in one place in the air. Then you set slam to be on and gravity scale to be 0 so that you don’t fall down. Then there is a while loop that says whenever slam is on, increase the gravity scale placeholder by 0.1. Then when the button is released you set the gravity scale to the gravity placeholder and reset the gravity scale placeholder to 1. Then on event on landed, you set the gravity scale back to 1 and slam to be off.

Whenever I try to play my game and try to slam, it freezes and gives me this error message:

When I click on the outputs it takes me to the standard macros bar on the while loop.
Does anyone know how to fix this?

BP are single threaded. The exit condition should be set inside the loop, otherwise, it never exits = infinite loop.

While loop will loop through in a single frame. You need to make a custom while loop node with a delay inside it or use a timer.

Yeah I ended up making a timer and it worked. Thanks!