How To Make A Script That Will Change All The Parts Called 'Test' Turn Yellow And Leave Others
I am not sure where your parts are, so I am going to assume they are in the workspace. Here's how to change every part named test in the workspace yellow: Keep in mind that this will only change parts directly inside of the workspace, not parts inside parts or parts inside models.
location = game.Workspace --loop through all the parts in the workspace for _, child in pairs(location:GetChildren())do --check to see if the item we're looking at is a part and it's name is test if child.Name == "Test" and child:IsA("BasePart") then --if it is, change the bricks color to bright yellow. child.BrickColor = BrickColor.new("Bright yellow") end end
If you want to look at ALL parts in the workspace, including parts inside parts or parts inside models.
location = game.Workspace --loop through all the parts in the workspace for _, descendant in pairs(location:GetDescendants())do --check to see if the item we're looking at is a part and it's name is test if descendant.Name == "Test" and descendant:IsA("BasePart") then --if it is, change the bricks color to bright yellow. descendant.BrickColor = BrickColor.new("Bright yellow") end end