example i want to get things that not game.Workspace.Model:GetChildren()
And it’ll print everything except things that inside game.Workspace.Model:GetChildren()
You can use IsDescendantOf()
method to skip instances which you want to exclude in a loop.
For example if you want to get every instance in workspace
except a specific model's
descendant then you could use the following code:
for _, descendant in workspace:GetDescendants() do
if descendant:IsDescendantOf(model) then
continue
end
-- Code you want to run for other instances
end
You can create a table and add the instances that aren’t descendants of the model
(or any other instance) you specified.
What about :GetTagged()
???
Using tags could also work, although if you want to get everything except descendants of the model
you’d have to tag everything except the descendants of the model
if you’re using GetTagged()
.
Alternatively you could only tag descendants of the model
and loop through the descendants of workspace
and skip the ones that are tagged (with HasTag()
). I’m not sure though if it’s any faster or more convenient than using IsDescendantOf()
.
Thanks! but I prefer this, I’ll mark you as solution for others
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.