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" ?
How to delete all objects with this name in folder?
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
Ok, so if you knew that this was a request question, why did you bother answering it?
Also, your code is a bit gross. Use "workspace" instead of "game:GetService("Workspace")".
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.
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.
.
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
Please elaborate?
ONE more :)
That doesn't work. You're attempting to call a nil method from a table.
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.
@Betuven Stop it.
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.

2 comments
You can run a for loop through each part and delete them one by one.
i need script