Can a script get all parts named the same thing?

Hello!
I was wondering if a script would get all parts that are named the same in one value. I want to use this to change a whole models color with just one script that is not 1000 lines long. Please help.

Yes, you can.

for i,v in pairs(workspace:GetDescendants()) do
if v.Name == SpecialPartName then
-- your code
end
end
3 Likes

No problem. Glad I could help!

You should mark a post as a solution whenever you find a solution to your problem so 1. Other people can know you already found a solution. 2. Others can quickly jump to the solution if they have the same problem.

:ok_hand: //Trying to make this long//

Oh okay. You can always swap the solution around.