Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to destroy all Parts with a specific name?

how to destroy all parts with the name "Test"?

(not only in workspace but also in models in workspace)

1 answer

✓ Accepted answer
local descendants = game.Workspace:GetDescendants()
 
-- Loop through all of the descendants of the Workspace. If a
-- BasePart is found, the code changes that parts color to green
for index, descendant in pairs(descendants) do
	if descendant.Name = "Test" then
		descendant:Destroy()
	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.