How do I loop this script?
script.Parent.Text = "Hello"
wait(5)
script.Parent.Text = "Bye"
How do I loop this script?
script.Parent.Text = "Hello"
wait(5)
script.Parent.Text = "Bye"
while wait() do
script.Parent.Text = "Hello"
wait(5)
script.Parent.Text = "Bye"
wait(5)
end
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.
If you want to get fancy you can make it loop over a certain duration by making it a function and using a variable to stop the loop
local messages = {"Hello", "Bye"};
local loop = true
function loopMessages()
while loop do
for _, v in pairs(messages) do
script.Parent.Text = v
wait(5)
end
end
end
loopMessages()
wait(100)
loop = false