How To Make A Script That Will Change All The Parts Called 'Test' Turn Yellow And Leave Others
✓ ANSWER ACCEPTED
How To Make A Script That Will Change All The Parts Called 'Test' Turn Yellow And Leave Others?
1 answer
✓ Accepted answer
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
2 comments
0
Thank You So Much
0
no problem let me know if you need anymore help. you might find quicker help on scripting helper's discord:https://discordapp.com/invite/UDpAX35 it's a lot more active than the website.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
where are the parts that you want to change color? do you want to look in a folder? in the workspace?
Nope, Everything Is Okay