While loop not going through loop body

Hello. I am having a small problem with one of my while loops. I want to make it so when the player holds the left mouse button down it deals damage, delays then deals damage again; and when the button is released it stops dealing damage. However this current setup isn’t working. It won’t go through the loop body and the only way I can fire the code is by connecting the completed node upto the line trace. Can anyone see what I’m doing wrong? Many thanks.

You can’t have delay in loops. Basically it’s ignored.

If you want this sort of structure, you need something more like:

I’ve tried taking the delay node out but it still doesn’t fire the loop body. If I set the boolean when pressed and released then use that it’s an infinite loop every time. I’ve tried your suggested setup but it doesn’t work. Is some stuff a custom event? If so where does it fire from? If it’s not then where does the branch fire from?

Classic timer:

PewPews 5x per second. Or even:

1 Like

The top one has worked and I’ll keep the bottom one in mind for future projects. You’re a star thank you so much.

1 Like