As far as I am aware, you can not have a parent that is nil. Unless…
But with the following code I’m getting an error explainable if that were the case:
LOCAL SCRIPT:
local function isShip(whatever)
return string.find(string.lower(whatever.Name),"ship") and whatever:FindFirstChild("Weld")
end
local function findFirstAncestor(descendant, callback)
while not callback(descendant) do
if descendant == game then return nil end
descendant = descendant.Parent
end
return descendant
end
local m = findFirstAncestor(script,isShipNamed)
is erroring saying .Name is not a valid member of nil/whatever
How could this be the case? It can only be in the game, what is actually going on?
P.S. This is during running 6 players in a local test on my laptop; one of the client simulations throws it. If something isn’t WaitForChild, you’re going to hear it, it’s uber-tardy at that amount.