Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

For Loop help?

Asked by
iLegitus 130
10 years ago

So,I am trying to do this :

while true do
wait()
tl = game.Workspace.s.SurfaceGui.TextLabel
tl.Text = "HI!"
wait(1)
tl.Text = "HI LOL"
wait(1)
tl.Text = "UM HELLO!?"
end

Is there a way to do that using a for loop? Like,You make it say those three words after each other,While waiting 1 second in between?

1 answer

Log in to vote
2
Answered by
MrNicNac 855 Moderation Voter
10 years ago

Yes, you can also improve organization through a for loop plus a table of what to do.

local Words = {"Hello", "LOL", "Um, hello?!"};
local TL = Workspace.s.SurfaceGui.TextLabel;

for Index, Word in pairs(Words) do
    TL.Text = Word;
    wait(1);
end
Ad

Answer this question