Delay in For Each Loop

How do I add a delay so that “For Each Loop” loops execute each successive step with a delay and not all at once?

Here I have a simple way to change the color of the Rounded Box from black to green (this represents the skill refresh)

The game first changes the green boxes to black, and then it should change each of the 10 images to green one by one every 2seconds.

But after adding “Delay” to “For Each Loop” the loop only returns the first item and nothing else, when I remove “Delay” the loop displays all items correctly
But it does it immediately

The rest where the color change is I have figured out, I just need to add a delay between each element from the array

Are you in a writing this code in a function? Because in functions you can’t add delays. If not just right click and search for delay, then connect it where you want.

If you are in a function you can use delays by creating a custom event in your EventGraph.

Hope I was helpful if you have other questions I’ll be happy to answer it all :slight_smile:

I think OP’s objective is to have a delay between each iteration of the loop, which can’t be succeeded by simply placing a delay after the Loop Body pin.

@Deadlyo0 you can check out this tutorial to see how to edit the existing macro (not recommended) or create a new macro with your desired behavior, and more:

Keep this in mind tho. But still you can collapse your new macro for organization purposes, even if you can’t collapse it to a function.

Hope this helps :blush:

1 Like

This is a standard event graph

How do you make it?

The loop needs to change a different variable Image1, Image2, Image3 and so on up to Image10 with each repetition

Man gets tired of delay, combines an hour and it turns out to be a simple thing for 2 minutes of work xD

Works perfectly

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.