How can I delete all of one type of object?

I want to all decals from my build because it is lagging it immensely but I don’t know how without individually selecting them all

It’s simple, just iterate through all of the instances in your build and check if it’s a decal. Then destroy it.

Just search up the name of the decal (if they have the same name) and select all of them and delete it.

1 Like

Run this on the command bar:

local model=*insert the build you want to remove the decals from here* local function clearAllDecals() if model:FindFirstChildWhichIsA("Decal",true) then model:FindFirstChildWhichIsA("Decal",true):Destroy() clearAllDecals() end end clearAllDecals()

Also, don’t forget to reference the build you want to destroy IN the command bar code before running it.
To reference something, simply look on the Explorer and progressively type where it is like this: game.Workspace.ExampleBuild

command
Also, to enable the command bar, simply go to the “View” tab on Studio and look for the setting.

for _,instance in pairs(workspace:GetDescendants()) do
   if instance:IsA('Decal') then
      instance:Destroy()
   end
end

You can paste this into your Command bar inside of studio and it’ll remove all of the decals inside of workspace. If you want to stick to a specific model, just call that instead of workspace.

6 Likes
local Model = workspace
local ClassTypes = {
	"Decal",
	"Texture"
}

for _, v in ipairs(workspace:GetDescendants()) do
	if table.find(ClassTypes, v.ClassName) then
		print(v.ClassName)
		--test the script before deleting, remove the dashes beside the line below when ur ready
		--v:Destroy()
	end
end

this will loop through all descendants of workspace, or a model, and see if its class name is in the table

run this in the command bar, at the bottom of studio
if it isn’t there, click this:

image

local target=--model name
local objectType="Weld"
local objects=target:GetDescendants()
local progress=0
local goal=#objects
coroutine.wrap(function()
	while progress<goal do
		wait(0.2)
		print(string.sub(tostring(progress/goal*100),1,4).."% complete")
	end
end)()
for index,object in pairs(objects) do
	if object and object:IsA(objectType) then
		object:Destroy()
	end
	if math.fmod(index,100)==0 then progress=index wait() end
end
progress=goal

Run this in command bar. Progress will be on output screen