Iterating between function calls

I’m working on finishing up my dialog UI, and in theory it’s really simple- for each line in some TArray<FString> lines, create a speech bubble, display the text in it, then destroy said bubble when the player hits X and advance to the next one. Once you’ve iterated through the entire array, end the dialog and return gameplay control to the player.

Where I’m really having trouble is with the iteration part- I can’t put this in one big function, because the player is manually iterating through the array with X in their own time. The cleanest way I’ve figured out to do this is to place the array and some int currentIndex on my HUDController’s event graph, check if currentIndex >= array->Num(), and empty the array + reset currentIndex if it is. This works, but it feels incredibly clunky- is there any slicker way to encapsulate what is essentially a foreach loop stepped through one buttonpress at a time?