As the title says
local folder = script.Parent.Parent function onClicked(mouse) folder.Stage1.L.Transparency = 1 folder.Stage1.L.CanCollide = false folder.Stage1.R.Transparency = 1 folder.Stage1.R.CanCollide = false folder.Stage2.L.Transparency = 0 folder.Stage2.L.CanCollide = true folder.Stage2.R.Transparency = 0 folder.Stage2.R.CanCollide = true wait(0.1) folder.Stage2.L.Transparency = 1 folder.Stage2.L.CanCollide = false folder.Stage2.R.Transparency = 1 folder.Stage2.R.CanCollide = false folder.Stage3.L.Transparency = 0 folder.Stage3.L.CanCollide = true folder.Stage3.R.Transparency = 0 folder.Stage3.R.CanCollide = true wait(0.1) folder.Stage3.L.Transparency = 1 folder.Stage3.L.CanCollide = false folder.Stage3.R.Transparency = 1 folder.Stage3.R.CanCollide = false folder.Stage4.L.Transparency = 0 folder.Stage4.L.CanCollide = true folder.Stage4.R.Transparency = 0 folder.Stage4.R.CanCollide = true wait(0.1) folder.Stage4.L.Transparency = 1 folder.Stage4.L.CanCollide = false folder.Stage4.R.Transparency = 1 folder.Stage4.R.CanCollide = false folder.Stage5.L.Transparency = 0 folder.Stage5.L.CanCollide = true folder.Stage5.R.Transparency = 0 folder.Stage5.R.CanCollide = true wait(0.1) folder.Stage5.L.Transparency = 1 folder.Stage5.L.CanCollide = false folder.Stage5.R.Transparency = 1 folder.Stage5.R.CanCollide = false folder.Stage6.L.Transparency = 0 folder.Stage6.L.CanCollide = true folder.Stage6.R.Transparency = 0 folder.Stage6.R.CanCollide = true wait(0.1) folder.Stage6.L.Transparency = 1 folder.Stage6.L.CanCollide = false folder.Stage6.R.Transparency = 1 folder.Stage6.R.CanCollide = false folder.Stage7.L.Transparency = 0 folder.Stage7.L.CanCollide = true folder.Stage7.R.Transparency = 0 folder.Stage7.R.CanCollide = true wait(0.1) folder.Stage7.L.Transparency = 1 folder.Stage7.L.CanCollide = false folder.Stage7.R.Transparency = 1 folder.Stage7.R.CanCollide = false folder.Stage8.L.Transparency = 0 folder.Stage8.L.CanCollide = true folder.Stage8.R.Transparency = 0 folder.Stage8.R.CanCollide = true wait(0.1) folder.Stage8.L.Transparency = 1 folder.Stage8.L.CanCollide = false folder.Stage8.R.Transparency = 1 folder.Stage8.R.CanCollide = false folder.Stage9.L.Transparency = 0 folder.Stage9.L.CanCollide = true folder.Stage9.R.Transparency = 0 folder.Stage9.R.CanCollide = true wait(0.1) folder.Stage9.L.Transparency = 1 folder.Stage9.L.CanCollide = false folder.Stage9.R.Transparency = 1 folder.Stage9.R.CanCollide = false folder.Stage10.L.Transparency = 0 folder.Stage10.L.CanCollide = true folder.Stage10.R.Transparency = 0 folder.Stage10.R.CanCollide = true wait(0.1) folder.Stage10.L.Transparency = 1 folder.Stage10.L.CanCollide = false folder.Stage10.R.Transparency = 1 folder.Stage10.R.CanCollide = false folder.Stage11.L.Transparency = 0 folder.Stage11.L.CanCollide = true folder.Stage11.R.Transparency = 0 folder.Stage11.R.CanCollide = true wait(0.1) folder.Stage11.L.Transparency = 1 folder.Stage11.L.CanCollide = false folder.Stage11.R.Transparency = 1 folder.Stage11.R.CanCollide = false folder.Stage12.L.Transparency = 0 folder.Stage12.L.CanCollide = true folder.Stage12.R.Transparency = 0 folder.Stage12.R.CanCollide = true wait(0.1) folder.Stage12.L.Transparency = 1 folder.Stage12.L.CanCollide = false folder.Stage12.R.Transparency = 1 folder.Stage12.R.CanCollide = false folder.Stage13.L.Transparency = 0 folder.Stage13.L.CanCollide = true folder.Stage13.R.Transparency = 0 folder.Stage13.R.CanCollide = true wait(0.1) folder.Stage13.L.Transparency = 1 folder.Stage13.L.CanCollide = false folder.Stage13.R.Transparency = 1 folder.Stage13.R.CanCollide = false folder.Stage14.L.Transparency = 0 folder.Stage14.L.CanCollide = true folder.Stage14.R.Transparency = 0 folder.Stage14.R.CanCollide = true wait(0.1) folder.Stage14.L.Transparency = 1 folder.Stage14.L.CanCollide = false folder.Stage14.R.Transparency = 1 folder.Stage14.R.CanCollide = false folder.Stage15.L.Transparency = 0 folder.Stage15.L.CanCollide = true folder.Stage15.R.Transparency = 0 folder.Stage15.R.CanCollide = true wait(0.1) folder.Stage15.L.Transparency = 1 folder.Stage15.L.CanCollide = false folder.Stage15.R.Transparency = 1 folder.Stage15.R.CanCollide = false folder.Stage16.L.Transparency = 0 folder.Stage16.L.CanCollide = true folder.Stage16.R.Transparency = 0 folder.Stage16.R.CanCollide = true wait(0.1) folder.Stage16.L.Transparency = 1 folder.Stage16.L.CanCollide = false folder.Stage16.R.Transparency = 1 folder.Stage16.R.CanCollide = false folder.Stage17.L.Transparency = 0 folder.Stage17.L.CanCollide = true folder.Stage17.R.Transparency = 0 folder.Stage17.R.CanCollide = true wait(0.1) folder.Stage17.L.Transparency = 1 folder.Stage17.L.CanCollide = false folder.Stage17.R.Transparency = 1 folder.Stage17.R.CanCollide = false folder.Stage18.L.Transparency = 0 folder.Stage18.L.CanCollide = true folder.Stage18.R.Transparency = 0 folder.Stage18.R.CanCollide = true wait(0.1) folder.Stage18.L.Transparency = 1 folder.Stage18.L.CanCollide = false folder.Stage18.R.Transparency = 1 folder.Stage18.R.CanCollide = false folder.Stage19.L.Transparency = 0 folder.Stage19.L.CanCollide = true folder.Stage19.R.Transparency = 0 folder.Stage19.R.CanCollide = true wait(0.1) folder.Stage19.L.Transparency = 1 folder.Stage19.L.CanCollide = false folder.Stage19.R.Transparency = 1 folder.Stage19.R.CanCollide = false folder.Stage20.L.Transparency = 0 folder.Stage20.L.CanCollide = true folder.Stage20.R.Transparency = 0 folder.Stage20.R.CanCollide = true end script.Parent.ClickDetector.MouseClick:connect(onClicked)
Reason is that I have another 31 stages to add
you can shorten this by using a i,v pairs loop. The vocab you will need to know is :GetChildren() method. this is a method that will get all the childern of an object.
for i,v in pairs(script.Parent.Parent:GetChildren()) do v.L.Transparency = 1 wait() v.L.CanCollide = false wait() v.R.Transparency = 1 wait() v.R.CanCollide = false wait() v.L.Transparency = 0 v.L.CanCollide = true wait() v.R.Transparency = 0 wait() v.R.CanCollide = true end
this loop will repeat the same process for ever descendant of the folder
Hope i helped you
use the for I statement like so
folder = script.Parent.Parent function OnClicked(mouse) for i = 1, 20 do local t = folder:GetChildren() if t.Name == "Stage"..i then t.L.Transparency = 1 t.L.CanCollide = false t.R.Transparency = 1 t.R.CanCollide = false wait(0.1) end end end script.Parent.ClickDetector.MouseClick:connect(OnClicked)
this will make sure the Children are made transparent in order