Can Someone help me please??????
Ok, I made a building in Roblox. I am trying to make a switch for each floor. So that the Switch will turn off the lights. I cant figure this out. I have looked at lots of different switches and lights but none work. Here is a picture of my code and my explorer window. In the Explorer the file name for my 1st floor is FloorOneLights, and in that folder there are 90 light models(named Light). In each of those Models there are 17 Parts, 3 of the parts are named Bulb. Each of the Bulb parts contain a PointLight. any helpers out there??
As well if anyone know were to get good example code let me know please. and thanks for any help....?????
local ison = false script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0) function switch() if (ison == false) then ison = true script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, 2, 0) script.Parent.Parent.Light.Bulb.PointLight.Brightness = 15 else ison = false script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, -2, 0) script.Parent.Parent.Light.Bulb.PointLight.Brightness = 0 end end script.Parent.ClickDetector.MouseClick:connect(switch)
ok, I got it to work kind of. some of the lights work and some of them don't . anyone know why?
I had to cut some of it out because of its length so this is most of the code... only thing missing is more lights...
local ison = false script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 0) function switch() if (ison == false) then ison = true script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, 2, 0) script.Parent.Parent.Parent.Light1.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light1.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light1.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light10.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light10.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light10.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light11.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light11.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light11.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light12.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light12.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light12.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light13.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light13.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light13.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light14.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light14.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light14.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light15.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light15.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light15.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light16.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light16.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light16.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light17.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light17.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light17.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light18.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light18.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light18.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light19.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light19.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light19.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light2.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light2.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light2.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light20.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light20.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light20.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light21.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light21.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light21.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light22.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light22.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light22.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light23.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light23.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light23.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light24.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light24.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light24.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light25.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light25.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light25.Bulb2.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light26.Bulb.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light26.Bulb1.PointLight.Brightness = 15 script.Parent.Parent.Parent.Light26.Bulb2.PointLight.Brightness = 15 else ison = false script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0, -2, 0) script.Parent.Parent.Parent.Light1.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light1.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light1.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light10.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light10.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light10.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light11.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light11.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light11.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light12.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light12.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light12.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light13.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light13.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light13.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light14.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light14.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light14.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light15.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light15.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light15.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light16.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light16.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light16.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light17.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light17.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light17.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light18.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light18.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light18.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light19.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light19.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light19.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light2.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light2.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light2.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light20.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light20.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light20.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light21.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light21.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light21.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light22.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light22.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light22.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light23.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light23.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light23.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light24.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light24.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light24.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light25.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light25.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light25.Bulb2.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light26.Bulb.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light26.Bulb1.PointLight.Brightness = 0 script.Parent.Parent.Parent.Light26.Bulb2.PointLight.Brightness = 0 end end script.Parent.ClickDetector.MouseClick:connect(switch)
Put it in a code block and I might help.