script.Parent.ClickDetector.MouseClick:connect(function() script.Sound:play() if script.Parent.PointLight.Enabled == true then script.Parent.Light.Enabled = false else script.Parent.PointLight.Enabled = true if script.Parent.ClickDetector.MouseClick:connect(function() PointLight.Sound:pause() end end
Red at line 4 says 'then' expected near 'function' what does this mean and how do I fix it? :(
Help me please!
Why do you have two handlers for the event?
And you get that error because on line 4 there is an if statement, but no then.
Also you need a ) to close :connect(function()
on line 1.
On top of that, you have script.Parent.PointLight
once and script.Parent.Light
the second time. Which one is it?
Here's my attempt at fixing it:
script.Parent.ClickDetector.MouseClick:connect(function() script.Sound:play() if script.Parent.PointLight.Enabled == true then script.Parent.PointLight.Enabled = false else script.Parent.PointLight.Enabled = true end script.Sound:pause() end)