https://developer.roblox.com/en-us/api-reference/function/Instance/FindFirstAncestor
So I wanted to know how "FindFirstAncestor" works because I want to modify it for my personal needs. I already know how to use the function, but I want to know how it's source code works. It's source code isn't posted anywhere. How does it find the first ancestor?
I don't know but this is my guess. This is hardly tested and is very messy, and likely won't work but this is my basic idea.
local function findAncestor(object,name) local Parents = {} local Index = object local Done = false repeat table.insert(Parents,Index.Parent) print(Index) if Index.Parent.Name == name then Done = true elseif Index == game then Done = true end Index = Index.Parent until Done == true return Index end findAncestor(PartExample, "NameExample") -- Example