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.
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