I don’t get how setting up a timeout value for WaitForChild would be of any use. In this case, I’m only using WaitForChild on server scripts for consistency with the client-sided scripts, since in theory, I should be able to directly index into script.Parent.Humanoid without having to yield for anything. The fact that WaitForChild is experiencing an infinite yield means that for whatever reason,
- the server is downloading a corrupted(?) datamodel where the model is missing its Humanoid object.
OR 2. WaitForChild() is implemented in a fundamentally broken way that for whatever reason cannot find a child even if it indeed exists. Is there some “optimization” present in the code that does 1 FindFirstChild, and if that result is nil (maybe the script executed before child was loaded), it proceeds to infinitely returns that cached nil value?
I’m leaning more towards the second explanation because with the frequency of the error. In any case, if I were to add a timeout, the NPC script would still break because without the Humanoid, it can’t do anything and would just run into an index into nil error.
The console shows severity as error
Isn’t the WaitForChild infinite yield warning something alone the lines of
“Infinite yield possible on …” ?
The error console says “exhausted allowed execution time” which correct me if I’m wrong, occurs if you have a infinite loop without any yield, that executes and freezes the game until a hardware interrupt after a couple seconds. Is the error console just somehow logging the wrong error? I don’t get why WaitForChild() is eating up 100% of a server’s resources in an infinite loop without yielding to anything. I’m pretty sure the error console is just logging the wrong error, but if WaitForChild is forcing a hardware interrupt, then I think there’s a very very big problem here.
example of exhausted allowed execution time:

Here are the first couple lines of the fishmob script
--mob
local mob = script.Parent
local humanoid = mob:WaitForChild("Humanoid") --line 3 error is here
local animator = humanoid:WaitForChild("Animator")
local walk = animator:LoadAnimation(mob:WaitForChild("walk"))
local attack = animator:LoadAnimation(mob:WaitForChild("attack"))
local alive = true
local fishdefeated = game.ServerStorage.fishdefeated --bindable event
local attacksound = mob.Head:WaitForChild("attacksound")
local growl = mob.Head:WaitForChild("growl")
The errors in the error console say “Workspace”, keep in mind, these NPCS are originally stored in ServerStorage before being moved to the Workspace during the fight scene. The error seems to be occuring in the Workspace. RunContext is legacy so the scripts don’t run until the NPCS are in the workspace.