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 multiple instances of the same name with the same name parent?

If I had many models called "Tree" in the workspace and in each tree I had an IntValue called "HP," how could I delete all of the IntValues parented to any models called "Tree?" If there are any models not called "Tree" with an IntValue then the IntValue should not be destroyed.

I need to know how to edit my game this way. I know how to script the logic for this problem, I just need to know how to to edit my place in studio cause the command prompt is only 1 line.

1 answer

for d,tree in pairs(game.Workspace:GetChildren() ) do
if tree.Name == "Tree" then
if tree:FindFirstChild("IntValue") then
local int = tree:FindFirstChild("IntValue")
int:Destroy()
end
end
end

what this does is that it checks all the first children in workspace and checks if they are called Tree and if it is called Tree then it looks after IntValue and if it can find the IntValue then it deletes the intValue

4 comments

0

but how do i make it save in studio

0

oh so u just want to delete them from studio, then i recomment just searching for intvalue in workspace and mark everyone thats under the tree and then just delete

0

Just put the code in the command bar

0

there isnt a line u can use in the command bar to do it, u just have to do it manually

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