Hello there! I have a really long script and I want to make it to a short script. As I know it is called a loop? I am still learning LUA and don't know how to do it. Here is the script:
M = Instance.new("Message") M.Parent = game.Workspace M.Text = "L" wait(0.1) M.Text = "1" wait(0.1) M.Text = "2" wait(0.1) M.Text = "3" wait(0.1) M.Text = "4" wait(0.1) M.Text = "5" wait(0.1) M.Text = "6 " wait(0.1) M.Text = "7" wait(0.1) M.Text = "8" wait(0.1) M.Text = "9" wait(0.1) M.Text = "10" wait(1) M.Text = "" x.Parent = game.Workspace wait(3) M:Remove()
How do I make it really short?
You can use a for loop
, just as you mentioned!
m = Instance.new("Message",workspace) m.Text = "L" for i = 1,10 do wait(.1) m.Text = i end wait(1) m.Text = "" wait(3) m:Destroy()
Learn more here: