Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Could someone explain what "ancestor" means in scripting?

I was browsing around in the object browser, when I saw a bunch of ancestor functions. What do they do?

1 comment

0

"Ancestor" just refers to a parent of an object. Workspace, for example, is the ancestor of all game parts. Ancestor = parent, descendant = child

2 answers

An ancestor of a part simply means the parent of the part. So, if a particle effect's parent is part, the fire's ancestor is part.

An ancestor of an object is like the opposite of the children of an object. For example, a part in 'Workspace' has the ancestors 'Workspace' and 'game'.

local part = Instance.new('Part', workspace)
print(part:FindFirstAncestor('Nonexistant')) -- Prints nil
print(part:FindFirstAncestor('Workspace').Name) -- Prints 'Workspace'

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