How to loop text?

add a wait(5) or something like that at the bottom or else it will just stay at “Hello”

local messages = {"Hello", "Bye"};

while true do
    for _, v in pairs(messages) do
          script.Parent.Text = v;
          wait(5);
    end;
end;

I would suggest this script.