Hey, guys~ Here is my code:
l1 = script.Parent.Parent.Layout1
l2 = script.Parent.Parent.Layout2
l3 = script.Parent.Parent.Layout3
l4 = script.Parent.Parent.Layout4
l5 = script.Parent.Parent.Layout5
l6 = script.Parent.Parent.Layout6
l7 = script.Parent.Parent.Layout7
clicked = false
function onClick()
if l1 and l2 and l3 and l4 and l5 and l6 and l7 and clicked == false then
clicked = true
l1.Visible = true -- ON
l2.Visible = false
l3.Visible = false
l4.Visible = false
l5.Visible = false
l6.Visible = false
l7.Visible = false
wait()
clicked = false
end
end
script.Parent.MouseButton1Down:connect(onClick)
The code itself works fine, but it is copied and pasted to seven different locations and I have to change which layout visibility is true and false for each one. Is there a more efficient way to write this?
