[SCRIPT]>>Button>>Controls>>EmergencyLights<<Emergency Light(MULTIPLE)
function onClicked() if script.Parent.Parent.Parent.EmergencyLight.Toggle.Value == true then script.Parent.Parent.Parent.EmergencyLight.Toggle.Value = false else script.Parent.Parent.Parent.EmergencyLight.Toggle.Value = true end end
The script has three parents, the first is the part(button), the second is controls(Group of parts that make up a panel that controls other stuff), and the third is the main group, which contains the lights and controls. The object called "Toggle" is a true/false value that decides whether the light(s) is on. If anyone knows how to tell my script to toggle all of the lights please tell me!
function onClicked() if script.Parent.Parent.Parent.EmergencyLight.Toggle.Value == true then script.Parent.Parent.Parent.EmergencyLight.Toggle.Value = false else script.Parent.Parent.Parent.EmergencyLight.Toggle.Value = true end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
to turn them all on:
Local LightModel = script.Parent.Parent.Parent function onClicked() if script.Parent.Parent.Parent.EmergencyLight.Toggle.Value == true then for k,v in pairs(LightModel:GetChildren()) do v.Toggle.Value = false end else for k,v in pairs(LightModel:GetChildren()) do v.Toggle.Value = true end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
should be right, but you might want to change the paths. Essentially, it iterates through the model's parts and changes the value you want.