I am trying to make a lamp in my game. I have a brick, which inside has a PointLight, ClickDetector, and the script to make it work...except it WON'T work!
The script is this -
function onClick()
if script.Parent.PointLight.Enabled == true then
script.Parent.PointLight.Enabled = false
elseif script.Parent.PointLight.Enabled == false then
script.Parent.PointLight.Enabled = true
end
end
script.Parent.Parent.ClickDetector.MouseClick:conncet(onClick)
It seems to work if I make it instead of
script.Parent.PointLight.Enabled
making the script say
game.Workspace.Lamp.PointLight.Enabled
That would be a pain because I would have to rename all of the lamps in the game and there are going to be many of them...if anyone can help please do! :) |