game.Workspace.Lamp.Bulb.SpotLight.Range = light light = 0 function onClicked()
if light == 0 then light = 1
end endscript.Parent.ClickDetector.MouseClick:connect(onClicked)
First of all, you seem to have the first variable the opposite way around (the variable name should come before the equal sign, and the value after):
local light = game.Workspace.Lamp.Bulb.SpotLight.Range
The other problem is that, when using value objects, you have to make sure to include .Value every time you read from/write to that value:
if light.Value == 0 then light.Value = 1 end
Hope this helps!