I am editing a flashlight script that works with a flashlight I built. When you click, the SpotLight in a part is enabled like a normal flashlight would and turns off when you click again. It is also supposed to make another part called "lighton" visible (basically a yellowish neon part at the front that adds to the visual effect with the SpotLight that the flashlight is turned on), but it isn't working. It changes the transparency of the neon part to 0, but doesn't change it back to 1 when you click again like the SpotLight turns off after you click.
Hopefully that made enough sense, and I apologize for my bad scripting skills. Here's the script:
player = game.Players.LocalPlayer
tool = script.Parent
repeat wait() until player
tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
tool.Light.SpotLight.Enabled = not tool.Light.SpotLight.Enabled
tool.Handle.Sound:Play()
tool.lighton.Transparency = not tool.lighton.Transparency
end)
end)

1 comment
You are a life-saver. Thank you so much!