Trying to make a click detector button for different types of lights. All of the lights are billboard gui's, but I am just trying to enable and disable to shut them off. Also the lights are all individual. I feel like I'm missing a variable. Help please?
``
local isOn = false
function on()
for i = 1, 18 do
local light = script.Parent["RedLight" .. i].RedLight.Enabled
isOn = true
end
function off()
for i = 1, 18 do
local light = script.Parent["RedLight" .. i].RedLight.Enabled
isOn = false
end
function onClicked()
if isOn == true then off() else on() end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
on()

2 comments
This is image lights, not stats.
I never mentioned "stats".. explain yourself better.. there's no such thing as 'Image lights", so say exactly what instance you are working with.