How can i reference or remove an specific type element?

How can i reference a specific type element ? For example: A code that remove all “parts” of the workspace without the need of them having to be named necessarily “part”. Simply all the part type elements

Use instance:IsA. Using that you can check if the instance is a Basepart and remove it.

  for i,v in ipairs(workspace:GetDescendants()) do
      if v:IsA("BasePart") then
1 Like