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

How can i use a for i to make this script waay shorter?

Asked by
hokyboy 270 Moderation Voter
5 years ago
01local frame = script.Parent.Parent.AlanWalkerFaded
02 
03script.Parent.MouseButton1Click:Connect(function()
04    script.Parent.Visible = false
05    script.Parent.Parent.AlanWalkerFaded.Visible = true
06    script.Parent.Parent.TextLabel.Visible = false
07    -- Song
08    wait(9)
09    frame.Round1.Visible = true
10    wait(0.8)
11    frame.Round1.Visible = false
12    frame.Button1.Visible = true
13    wait(0.6)
14    frame.Button1.Visible = false
15    frame.Button2.Visible = true
View all 86 lines...

so i have this script and for obvious reasons its not practical how can i make a for i so it will just count up the buttons without me having to manuly add it?

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago
01local frame = script.Parent.Parent.AlanWalkerFaded
02 
03script.Parent.MouseButton1Click:Connect(function()
04    script.Parent.Visible = false
05    script.Parent.Parent.AlanWalkerFaded.Visible = true
06    script.Parent.Parent.TextLabel.Visible = false
07    wait(9)
08    frame.Round1.Visible = true
09    wait(0.8)
10    frame.Round1.Visible = false
11    frame.Button1.Visible = true
12    wait(0.6)
13    for i = 1,29 do
14        frame["Button" .. i].Visible = false
15        frame["Button" .. i + 1].Visible = true
16        wait(0.6)
17    end
18end)

This should make it work, hope it helps (I’m not that good with explaining)

Ad

Answer this question