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()
if script.Parent.Parent.Parent.Lights.Lamp.SpotLight.Brightness == 100 then
script.Parent.Parent.Parent.Lights.Lamp.SpotLight.Brightness=0
else
script.Parent.Parent.Parent.Lights.Lamp.SpotLight.Brightness=100
end
end
script.Parent.ClickDetector.MouseClick:connect(onClick)
2 comments
I want the spotlight to go off and on on the click of a button
In the edit, I added what I think would help. I have not tested it however. If you notice though, there is now an if and else statement that checks the birghtness of the spotlight and changes it accordingly. Also, don't forget to add an "end" after using these statements.