hello i want to delete all these parts that are all corroded material
Try this!
function destroyPartsOfMaterial(child,material) for ind, part in pairs(child:GetChildren()) do if part:IsA("BasePart") and part.Material==Enum.Material[material] then part:Destroy() end destroyPartsOfMaterial(part,material) end end destroyPartsOfMaterial(workspace,"CorrodedMetal")
You can use this for any material! Just change CorrodedMetal to the material you want!
Here's a non-recursive solution:
local Material = "Neon" for _,part in pairs(workspace:GetDescendants()) do if part:IsA("BasePart") and part.Material == Enum.Material[Material] then part:Destroy() end end