Access each element of array one after the another using foreachloop?

What i am trying to do here is:
I am passing an array of string to the event StartBotMove. And each string is either F, B, L, or R. Next i want in respect of each string the bot should move in respective direction and i have given a 3 sec timeline for translating it from current position to next position. The problem is all of that happen concurrently. I want it to happen sequentially… how do i do it???

Ok i got it that the loop will not wait for timeline to finish. So now how do i get the sequential execution from first index to the last one?
I could use switch but that too is just for single comparison i had to loop throughout the length.

Well I found my way around using the Tick Event method in the blueprint. I am not sure if this is the best way, but i got with it hopefully it works in your case too. If there is any other way please mention in below.

Hey sorry I was sleeping,

Here is what I would do. Go back to using the timeline, but instead of looping inside of a for/while loop, store a local variable in your blueprint that stores the current index of the element you want moving. Then in your timeline “Finished” node, increment the index and restart the timeline with your new index element.

No problem. :slight_smile:
I did the same thing just for looping i used event tick instead of any for, foreach, while loop.
If you know any other way do tell me, cuz i am not sure if this is the best way to go along.

Your for loop is not the same thing. It sounds like the same thing, but I can guarantee you it is not. Your for loop will not wait for animations to finish before iterating. What I just told you will wait till the timeline is finished before doing any iteration.

A for/foreach/while/do-while loop will loop until it is done before moving on to anything else. What I describe will only attempt to iterate when the timeline has finished. They are not the same. Try the way I told you.