I am trying to make a light switch that changes the material too, but I can't figure it out. (Btw its not all my script, and I suck at scripting. So please go easy on me D;)
function onClicked(plyr)
v = script.Parent.Value
if v.Value == false then
v.Value = true
_G.Light.BrickColor = BrickColor.new("Fossil")
game.workspace.Light.Material = Enum.Neon
script.Parent.BrickColor = BrickColor.new("Bright red")
_G.Light.PointLight.Enabled = true
elseif v.Value == true then
v.Value = false
_G.Light.BrickColor = BrickColor.new("Black")
game.workspace.Light.Material = Enum.SmoothPlastic
script.Parent.BrickColor = BrickColor.new("Bright green")
_G.Light.PointLight.Enabled = false
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
If you can help, then thanks!

1 comment
You just made some typos on lines 6 and 12. Change “game.workspace” into “game.Workspace” or just type in “workspace” by itself.