Hello!
I recently came across a problem. Basically, I put a bunch of lights into my game which can be turned on and off. I want to disable some of the lights so that certain ones are on and some are off.
The problem is, when I join the game, the lights I selected to be disabled are still on. Does it have something to do with the on and off script?
On and off script:
local isOn = true
function on()
isOn = true
script.Parent.Parent.Light.PointLight.Enabled = true
script.LightSwitchOn:Play()
end
function off()
isOn = false
script.Parent.Parent.Light.PointLight.Enabled = false
script.LightSwitchOff:Play()
end
function onClicked()
if isOn == true then off() else on() end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
on()