FindFirstAncestorOfClass
First matching ancestor, or nil.
Syntax
:FindFirstAncestorOfClass(class: any) -> any
Parameters
| Parameter | Type | Description |
|---|---|---|
class | any | The class value used by the call. |
Returns
| Type | Description |
|---|---|
any | The value produced by the call. |
Description
FindFirstAncestorOfClass is part of the Instances library. Instances are live proxies backed by game memory. Property reads and method calls go through Roblox's own objects.
The call is read-only: it resolves the current value when invoked and does not change the underlying state.
The aliases :FindFirstAncestorWhichIsA(class) resolve to the same implementation.
Example
local part = workspace:FindFirstChildWhichIsA("BasePart")
if part then
print(part:FindFirstAncestorOfClass("Model"))
print(part:FindFirstAncestorWhichIsA("Model"))
end
Notes
- Aliases:
:FindFirstAncestorWhichIsA(class). - Instance proxies are backed by live game memory.