For some strange reason it is highlighting else as being red... Please help!
function onClick() script.Parent.Parent.Parent.Lights.Lamp.SpotLight.Brightness=100 else script.Parent.Parent.Parent.Lights.Lamp.SpotLight.Brightness=0 end script.Parent.ClickDetector.MouseClick:connect(onClick)
It is highlighted because there is no "If" statement.
Every "else" needs an "if" to go along with it.
I would help you finish the script, but I am unsure what you are trying to accomplish.
Example of if and else:
if x < 8 then x = x + 5 else x = x - 5 end
In order to get what you want done, try something like this...
function onClick() --The following if statement will check the brightness of the spotlight if script.Parent.Parent.Parent.Lights.Lamp.SpotLight.Brightness == 100 then -- If the spotlight is already 100, then it will bring it down to 0 script.Parent.Parent.Parent.Lights.Lamp.SpotLight.Brightness=0 else -- If the spotlight is anything else, it will set it to 100 script.Parent.Parent.Parent.Lights.Lamp.SpotLight.Brightness=100 end end script.Parent.ClickDetector.MouseClick:connect(onClick)