function WorkingLightSwitch()
local state = script.Parent.LightState
local switchOn = script.Parent
local switchOff = script.Parent.Parent.switchOff
local neon = script.Parent.Parent.Neon
if state.Value == false then
state.Value = true
neon:GetChildren().Material = "Neon"
switchOn.Transparency = 0
switchOff.Transparency = 1
else
state.Value = false
neon:GetChildren().Material = "Plastic"
switchOn.Transparency = 1
switchOff.Transparency = 0
end
end
script.Parent.ClickDetector.MouseClick:connect(WorkingLightSwitch)
It's a light switch, I have several neon blocks that I want to turn on and off once clicked. And they're in a model called Neon.
Apparently the switchOn and switchOff seem to work, but the neon:GetChildren() doesn't seem to work. Help?

1 comment
I think you use for i,v instead of get children.