PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

FindFirstAncestor

Returns the first ancestor of the Instance whose Instance/Name is equal to the given name.

This function works upwards, meaning it starts at the Instance’s immediate Instance/Parent and works up towards the DataModel. If no matching ancestor is found, it returns nil.

The following code snippet would find the first ancestor of the object named ‘Car’.

local car = object:FindFirstAncestor("Car")

For variants of this function that find ancestors of a specific class, please see Instance/FindFirstAncestorOfClass and Instance/FindFirstAncestorWhichIsA.

Parameters

Name Type Default Description

The Instance/Name to be looked for.

Returns

Return Type Summary

The Instance found.