Delete all objects with the same name in different parts of the workspace

Hello guys! I have an issue of my project, it have a lot of unwanted scripts, like A LOT.
I would like to remove it, but they are in different models and folders, they all have the same name.
There’s a command or anything that I could do to make it easily?

4 Likes

Heya! Just search up the name in search bar and delete them, scripts won’t work for that, although you could try a plugin.

1 Like
for _, scr in pairs(workspace:GetDescendants()) do
	if scr.ClassName ~= "Script" or scr.Name ~= "SCRIPTNAMEHERE" then
		continue
	end
	scr:Destroy()
end

You run this in the command line nad replace SCRIPTNAMEHERE with the name given to those scripts

14 Likes

how would you make this with a onmousebuttonclick?

My Code:

script.Parent.MouseButton1Click:Connect(function()
	

	for _, scr in pairs(script.Parent.Parent.Parent.Main:GetDescendants()) do
		if scr.ClassName ~= "TextLabel" then
			scr:Destroy()
		end
		
		
		
	end
end)