Script:
local Lights = script.Parent.Lights
local a = Lights.A
local b = Lights.B
local c = Lights.C
local d = Lights.D
local e = Lights.E
local f = Lights.F
local g = Lights.G
local h = Lights.H
local i = Lights.I
local j = Lights.J
local k = Lights.K
local l = Lights.L
local Check = script.Parent.ButtonG.Button.Check.Value
function Rotate() -- Light Rotation
a.Material = "Neon"
wait(0.1)
a.Material = "SmoothPlastic"
b.Material = "Neon"
wait(0.1)
b.Material = "SmoothPlastic"
c.Material = "Neon"
wait(0.1)
c.Material = "SmoothPlastic"
d.Material = "Neon"
wait(0.1)
d.Material = "SmoothPlastic"
e.Material = "Neon"
wait(0.1)
e.Material = "SmoothPlastic"
f.Material = "Neon"
wait(0.1)
f.Material = "SmoothPlastic"
g.Material = "Neon"
wait(0.1)
g.Material = "SmoothPlastic"
h.Material = "Neon"
wait(0.1)
h.Material = "SmoothPlastic"
i.Material = "Neon"
wait(0.1)
i.Material = "SmoothPlastic"
j.Material = "Neon"
wait(0.1)
j.Material = "SmoothPlastic"
k.Material = "Neon"
wait(0.1)
k.Material = "SmoothPlastic"
l.Material = "Neon"
wait(0.1)
l.Material = "SmoothPlastic"
end
function OnClicked(playerWhoClicked) -- When button is clicked
wait(1)
Check = 1 -- 0 = Inactive and 1 = Active, thus making the game active
while Check == 1 do
Rotate()
wait(0.1)
end
if script.Parent.ButtonS.Button.ClickDetector.MouseClick then
Check = 0
end
end
script.Parent.ButtonG.Button.ClickDetector.MouseClick:connect(OnClicked)
Problem: 1: The script does not detect the click of the second button, thus unable to end. 2: The first button is able to be repeatedly activated.
If there's a section that can be simplified, please tell me. Cheers.
