I need help with this. I tinkered around with a free model (mainly for learning how coding works) and it isn't working. What is wrong here?
mylight = game.Workspace.Lamp.Lamp.ButtonLight.PointLight function click() mylight.Enabled = not mylight.Enabled end
Anyways, the output suggests putting a '=' sign by Function. Its not working. the 2nd line is the only problem. This is for a lantern with a clickable on/off button.
This probably isn't the most efficient way to deal with your issue, but it should still work fine.
Just replace this with your current function.
function click() if mylight.Enabled == true then mylight.Enabled = false else if mylight.Enabled == false then mylight.Enabled = true end end end
Exactly as above, except that you need to add the following:
--Edit ButtonPathHere with the path leading to your on/off button. ButtonPathHere.MouseButton1Click:connect(click)