I see people typing "child" , "parent" , "descendant" , "ancestors" but what do they mean like I only know child and parent but what is descendant and ancestor? What are the functions?
A descendant is a direct or indirect child. A good example is you are their grandparents. You are not directly their children but you're their descendant. But you're still your parents (mom and dad) descendants.
And they are your ancestors. The only functions I know of is GetChildren
, GetDescendats
, IsAncestorOf
, IsDescendantOf
.
For some reason roblox doesn't provide a GetAncestors
function.
Eh just for fun I wrote this.
local function get_ancestors(instance) local instance_parent = instance.Parent local ancestors = { instance_parent } while instance_parent do instance_parent = instance_parent.Parent table.insert(ancestors, instance_parent) end return ancestors end