Checking if part or unionoperation is not a descendant of

What I am trying to do is check if part ( or union operation ) is not a descendant of an object.

Is that possible? If it is can someone please help me with it?

You should see this article: Instance | Documentation - Roblox Creator Hub

It essentially returns a boolean value as to whether or not an instance is an ancestor of another instance which I believe is exactly what you’re looking for.

Hope this helps,
-Tom :slight_smile:

1 Like

IsAncestorOf checks if the instance it’s called on is a parent or within the parent tree of the instance, OP probably wants to check if the part is within the children tree of the instance which can be done with Instance | Documentation - Roblox Creator Hub


Both literally do the same thing, just exchange the parameters.

1 Like

if you want to check if something is a descendant of something else it’s generally much more efficient to use the function made to do just that rather than using a semi-hacky method of checking its parents and see if one of them is the object

1 Like

IsAncestorOf is literally exactly the same as IsDescendantOf, instead you change what you’re comparing. It doesn’t check every parent?

again - better to use the function designed to do the forward approach rather than trivializing it with an alternative functional but more confusing approach, if you want to continue the discuss we should probably do it in private message before this gets awfully close to breaking the devforum rules