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
local frame = script.Parent.Parent.AlanWalkerFaded

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Visible = false
    script.Parent.Parent.AlanWalkerFaded.Visible = true
    script.Parent.Parent.TextLabel.Visible = false
    -- Song
    wait(9)
    frame.Round1.Visible = true
    wait(0.8)
    frame.Round1.Visible = false
    frame.Button1.Visible = true
    wait(0.6)
    frame.Button1.Visible = false
    frame.Button2.Visible = true
    wait(0.6)
    frame.Button2.Visible = false
    frame.Button3.Visible = true
    wait(0.6)
    frame.Button3.Visible = false
    frame.Button4.Visible = true
    wait(0.6)
    frame.Button4.Visible = false
    frame.Button5.Visible = true
    wait(0.6)
    frame.Button5.Visible = false
    frame.Button6.Visible = true
    wait(0.6)
    frame.Button6.Visible = false
    frame.Button7.Visible = true
    wait(0.6)
    frame.Button7.Visible = false
    frame.Button8.Visible = true
    wait(0.6)
    frame.Button8.Visible = false
    frame.Button9.Visible = true
    wait(0.6)
    frame.Button9.Visible = false
    frame.Button10.Visible = true
    wait(0.6)
    frame.Button10.Visible = false
    frame.Button11.Visible = true
    wait(0.6)
    frame.Button11.Visible = false
    frame.Button12.Visible = true
    wait(0.6)
    frame.Button12.Visible = false
    frame.Button13.Visible = true
    wait(0.6)
    frame.Button13.Visible = false
    frame.Button14.Visible = true
    wait(0.6)
    frame.Button14.Visible = false
    frame.Button15.Visible = true
    wait(0.6)
    frame.Button15.Visible = false
    frame.Button16.Visible = true
    wait(0.6)
    frame.Button16.Visible = false
    frame.Button17.Visible = true
    wait(0.6)
    frame.Button19.Visible = false
    frame.Button20.Visible = true
    wait(0.6)
    frame.Button21.Visible = false
    frame.Button22.Visible = true
    wait(0.6)
    frame.Button23.Visible = false
    frame.Button24.Visible = true
    wait(0.6)
    frame.Button24.Visible = false
    frame.Button25.Visible = true
    wait(0.6)
    frame.Button25.Visible = false
    frame.Button26.Visible = true
    wait(0.6)
    frame.Button26.Visible = false
    frame.Button27.Visible = true
    wait(0.6)
    frame.Button27.Visible = false
    frame.Button28.Visible = true
    wait(0.6)
    frame.Button29.Visible = false
    frame.Button30.Visible = true

    end)

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
local frame = script.Parent.Parent.AlanWalkerFaded

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Visible = false
    script.Parent.Parent.AlanWalkerFaded.Visible = true
    script.Parent.Parent.TextLabel.Visible = false
    wait(9)
    frame.Round1.Visible = true
    wait(0.8)
    frame.Round1.Visible = false
    frame.Button1.Visible = true
    wait(0.6)
    for i = 1,29 do
        frame["Button" .. i].Visible = false
        frame["Button" .. i + 1].Visible = true
        wait(0.6)
    end
end)

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

Ad

Answer this question