Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How to make dynamic lighting turn on when touched or clicked?

Asked by 10 years ago

Like clicking or touching a brick so it will turn on

1 answer

Log in to vote
0
Answered by 10 years ago

Clicked:

Add ClickDetector To Part.

Add to part: Light, script and clickdetector.

Lua:

script.Parent.ClickDetector.MouseClick:connect(function()
if script.Parent.Light.Enabled == true then
script.Parent.Light.Enabled = false
else
script.Parent.Light.Enabled = true
end
end)

Touched:

Add to part: Script and light.

Lua:

script.parent.Touched:connect(function()
if script.Parent.Light.Enabled == true then
script.Parent.Light.Enabled = false
else
script.Parent.Light.Enabled = true
end
end)

Its simple just learn if.

Ad

Answer this question