Could anyone correct this script?
It is for my lighting system just need some help because it will not work.
I need help with
LP11.Enabled == true and
LP12.Enabled == true then do
LP1.Enabled = false and
LP2.Enabled = false and
What do I put instead of 'then do' and 'then'
LP1 = script.Parent.Parent.SpotLight12.Light.SpotLight
LP2 = script.Parent.Parent.SpotLight11.Light.SpotLight
LP3 = script.Parent.Parent.SpotLight10.Light.SpotLight
LP4 = script.Parent.Parent.SpotLight9.Light.SpotLight
LP5 = script.Parent.Parent.SpotLight8.Light.SpotLight
LP6 = script.Parent.Parent.SpotLight7.Light.SpotLight
LP7 = script.Parent.Parent.SpotLight6.Light.SpotLight
LP8 = script.Parent.Parent.SpotLight5.Light.SpotLight
LP9 = script.Parent.Parent.SpotLight4.Light.SpotLight
LP10 = script.Parent.Parent.SpotLight3.Light.SpotLight
LP11 = script.Parent.Parent.SpotLight2.Light.SpotLight
LP12 = script.Parent.Parent.SpotLight1.Light.SpotLight
btn = script.Parent.ClickDetector
function onClick()
if LP1.Enabled == true and
LP2.Enabled == true and
LP3.Enabled == true and
LP4.Enabled == true and
LP5.Enabled == true and
LP6.Enabled == true and
LP7.Enabled == true and
LP8.Enabled == true and
LP9.Enabled == true and
LP10.Enabled == true and
LP11.Enabled == true and
LP12.Enabled == true then do
LP1.Enabled = false and
LP2.Enabled = false and
LP3.Enabled = false and
L4P.Enabled = false and
LP5.Enabled = false and
LP6.Enabled = false and
LP7.Enabled = false and
LP8.Enabled = false and
LP9.Enabled = false and
LP10.Enabled = false and
LP11.Enabled = false and
LP12.Enabled = false and
else
LP1.Enabled = true
LP2.Enabled = true
LP3.Enabled = true
LP4.Enabled = true
LP5.Enabled = true
LP6.Enabled = true
LP7.Enabled = true
LP8.Enabled = true
LP9.Enabled = true
LP10.Enabled = true
LP11.Enabled = true
LP12.Enabled = true
end
end
btn.MouseClick:connect(onClick)

2 comments
This still does not work. When I click it, yes it turns on. But when I want all the lights to turn off it just turns off LP1 not anything else.
Any errors?