Fandom

ROBLOX Wikia

Method:IsAncestorOf

12,567pages on
this wiki
Add New Page
Talk0 Share

IsAncestorOf is a boolean method of Instance, and is used to determine whether the provided object is a child or distant child of the calling object. This function is recursive.

function object:IsAncestorOf(item)

local test = self

local function GetChildren(findIn)

if findIn == item then return true end

for _, child in pairs(findIn:GetChildren()) do

GetChildren(child)

end

return false

end

return GetChildren(test)

end

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.