Does anybody know how to make toggleable lights with only 1 switch? I tried to make a script to make headlights on my car but it only turns on and stays like that. I want it to turn on and off with only 1 button.Here is my script:
local button = script.Parent
local LightA = script.Parent.Parent.PointLight
local LightB = script.Parent.Parent.Parent.LightB.PointLight
local LightC = script.Parent.Parent.Parent.LightC.PointLight
local LightD = script.Parent.Parent.Parent.LightD.PointLight
button.MouseClick:connect(function()
LightA.Brightness = '10'
LightB.Brightness = '10'
LightC.Brightness = '10'
LightD.Brightness = '10'
end)
button.MouseClick:connect(function()
LightA.Brightness = '0'
LightB.Brightness = '0'
LightC.Brightness = '0'
LightD.Brightness = '0'
(LightA,B,C,and D are the parts)

1 comment
Don't take my word for it, but instead of using the Brightness, you could use disable and enable. I forgot if you could actually use Enable/Disable on lights, but go ahead and try.