I think the title is very self-explanatory
I have this one script that’s just FILLED with horrifying elseif statements, i’d love to NOT have those elseif statements but there’s no way to do :GetAscendants()
GetAncestor() only gets the parent (or was it :FindFirstAncestor??())
does someone know some methods of doing that???
you could get all ancestors of an instance like this
local function GetAncestors(x) local ancestors = {} while x.Parent ~= game do table.insert(ancestors,x.Parent) x = x.Parent end return ancestors end
You can use :FindFirstAnscestor() if there is something specific you want to find.
For example: part:FindFirstAnscestor(nameOfAnyParent)