Minimize the variables, with lots of them

Okay, so I am scripting a meltdown here, and all of the lights are supposed to turn red, but the only way I have found this to work for all of them is to have this long list of variables. How can I reduce those variable calls into less code?


So far, my solution has just been to only make certain lights turn red, and that helps a little, but is there any way to group all of these lights, and still let them be able to do this same thing?

1 Like

Well, you could try making an array with those objects, and then iterate those parts to make them red.

Loops allow you to go through multiple objects, one after the other, without setting a bunch of variables. It’s also more dynamic, so adding another part would be easier.

2 Likes

Thank you so much! I’ll work on that and see if it works. I appreciate the help.