Combining waits and loops and functions can be problematic and cause bugs so I try to stay away from that. To have more control with the timing and reducing bugs I like to use an approach such as : every X seconds, so you can control the speed - play array.at(var) where var is a global variable. Then underneath add 1 to var.
Because this won't work in the same event as the button press you would put it in its own event activating it with another global variable that works as on/off. You set it to on with button press. To stop the var from counting up forever you also have a condition that global var is not greater than array.width (the number of values), else set counting var to 0 and on/off var to off to reset.