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

How to delete all objects with this name in folder?

I have parts in folder game.Workspace.Map This parts is: "Nuke Hall Part" and i need delete this parts like this: game.Workspace.Map["Nuke Hall Part"]:ClearAllChildren but it's deleting only 1 nuke hall part, how to make this works and delete all "Nuke Hall Part" ?

2 comments

0

You can run a for loop through each part and delete them one by one.

0

i need script

2 answers

Hello, zuzuka5X

Since you actually tried, i will help you. But remember, you cannot just ask people to write SCRIPTS for you, this is not a REQUESTING SITE, instead, you could just search for questions such as this or try to find a method in wiki.

for _, I in pairs(game:GetService("Workspace").Map:GetDescendants()) do
if I:IsA("Part") or I:IsA("MeshPart") or I:IsA("UnionOperation") and I.Name == "Nuke Hall Part" then
I:Destroy()
end
end

Next time, don't forget to search the site, same goes for WIKI. Have fun!

RESOURCES : :GetDescendants() :IsA() :Destroy() :GetService() Workspace Instance.Name

5 comments

0

Ok, so if you knew that this was a request question, why did you bother answering it?

0

Also, your code is a bit gross. Use "workspace" instead of "game:GetService("Workspace")".

0

As i did mention, he actually TRIED, while the other guy didn't even care and just asked for a SCRIPT at the start, he was trying to find a method to remove every PART named "Nuke Hall Part" he is different from the other guy that asked for a PART that would react to PlaybackLoudness.

0

By the way, technically, there is no difference between workspace and game:GetService("Workspace") except their names and their method of getting Workspace, my SCRIPT works, so i don't have to change anything.

0

.

descendants = game.Workspace["Nuke Hall Part"]:GetDescendants()
for index, descendants in pairs (descendants) do
descendants:Destroy()
end

Sorry, can't provide much information but all I know is that this script gets all the children in the folder and then destroys in >:D Rather new to this so if someone could add some explanation to this would be great.

6 comments

0

Please elaborate?

0

ONE more :)

0

That doesn't work. You're attempting to call a nil method from a table.

0

There is also ONE more problem, he is trying to remove everything inside the PART which is supposed to be removed, instead, he should try to get the descendants of every PART inside the Map model.

0

@Betuven Stop it.

0

Me no idea what you guys are talking bout. But I once needed to destroy everything that was parented to the folder so I did that :) Im doubting that that isn't the question asked lol.

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