I am making a technology wing that has 4 generators, the generator are gonna work as when one goes off it dims when two goes off it dims even more, three even more, and four completely off. These generators have a big green button, I have put a click detector on the button and ik how to change a spotlight's brightness "light.spotlight.brightness = #" but I don't know how to select every light in the game. All the lights are in a group but idk how to change the brightness of an entire group. Ty for your help and time ;)
COMMUNITY QUESTION
Help needed to make a light switch to change every light in game?
1 answer
Simply iterate through the group of lights and change the brightness of each like so:
for _,light in pairs(game.Workspace.Lights:GetChildren()) do
light.SpotLight.Brightness = light.SpotLight.Brightness-0.1
end
Add that to your current script and with a bit of tweaking you can set it up for your game. If you need more help with this or it doesn't work, let me know in the comments with as much detail as possible. Otherwise, accept this as the answer!
1 comment
0
Ok thank you so much so instead of using setting the brightness variable I just use an operator (-) , didn't know you could do that, also thanks for the :GetChildren didn't know that was a thing :)
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
If General_Scripter's answer helped you, you should accept it. You both get rep for it.