PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
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.