Finding Parts in Models

Hello there!
I wanted to use a for loop to detect all parts in workspace named a certain thing. I know how to do that, but what I’m needing to do is detect a light inside a part, that is inside a model. How would I do that?

I think this will help you


Thanks! This does help a lot, but I’m having a bit of a hard time understanding where I input the part I want it to look for.
Here’s a bit of the reason why I’m doing this: I’m working on a meltdown for a labs game, and I want to use a for loop to change all the lights red. All of the lights are models, that contain unions, and a pointlight in a certain Union.

Just like it mentioned in the dev hub api reference, you can use descendant:IsA to determine if class of the instance is an pointlight, so it will do something with it if it’s true.
If you mean where put this part of code in a script, then you can put it anywhere you feel like to, as long as it works like you thought it would


Thank you so much! This helps a lot!