The following script is supposed to fade the lights off if they are on, and fade them on if they are off.
local Me = script.Parent
local H1 = game.Workspace.House_Lights.HouseLight_1.ReadInside.Light.Light.SpotLight
local H2 = game.Workspace.House_Lights.HouseLight_2.ReadInside.Light.Light.SpotLight
local H3 = game.Workspace.House_Lights.HouseLight_3.ReadInside.Light.Light.SpotLight
local H4 = game.Workspace.House_Lights.HouseLight_4.ReadInside.Light.Light.SpotLight
local H5 = game.Workspace.House_Lights.HouseLight_5.ReadInside.Light.Light.SpotLight
local H6 = game.Workspace.House_Lights.HouseLight_6.ReadInside.Light.Light.SpotLight
local H7 = game.Workspace.House_Lights.HouseLight_7.ReadInside.Light.Light.SpotLight
local H8 = game.Workspace.House_Lights.HouseLight_8.ReadInside.Light.Light.SpotLight
local H9 = game.Workspace.House_Lights.HouseLight_9.ReadInside.Light.Light.SpotLight
local AllHouse = H1, H2, H3, H4, H5, H6, H7, H8, H9 --WHERE THE H's ARE LISTED
local on_or_off = "off"
function onClicked ()
if on_or_off == "off" then --If the house lights are off then
game.Workspace.HouseLightButton.ClickDetector.MaxActivationDistance = 0
AllHouse.Enabled = true
Me.BrickColor = BrickColor.new("Dark green")
for i=0,60, 0.5 do
AllHouse.Brightness = i
wait(0.25)
end
game.Workspace.HouseLightButton.ClickDetector.MaxActivationDistance = 32
print("Lights are on. Rise and shine!")
on_or_off = "on"
else -- Otherwise, turn the houselights on
game.Workspace.HouseLightButton.ClickDetector.MaxActivationDistance = 0
Me.BrickColor = BrickColor.new("Bright red")
for i=60,0, -0.5 do
AllHouse.Brightness = i
wait(0.25)
end
game.Workspace.HouseLightButton.ClickDetector.MaxActivationDistance = 32
AllHouse.Enabled = false
on_or_off = "off"
print("Lights are off, goodnight.")
end
end
game.Workspace.HouseLightButton.ClickDetector.MouseClick:connect(onClicked)
The problem I'm having is it only fades on ONE of the lights (that's H1). None of the others respond. I'm not going into the program and individually telling each and every single one to turn on because that would be ridiculous. If you need any more information about something, I'll be happy to comply.

1 comment
Thanks SOOO Much. Your explanation was perfect. I'm happy you also agree with me that repeating the same command is ridiculous.