Attempt to index nil with Humanoid (CollectionService)

For some reason every time I try to call a function on a tagged mob to check for the humanoid’s health, it keeps saying “attempt to index nil with Humanoid”.
I’ve already done some tests and I can safely say that the “Mob” does exist and it does have a parent and it is an instance.
So I have no idea why this isn’t working, but it definitely feels like I’m overlooking something

local TaggedMobs = CollectionService:GetTagged("Ghoul")

--Function--
local function DecideAction(Mob)
    if Mob.Humanoid.Health <= 0 then 
		    print("Dead")
		   --Code
	    end
    end
end

--Main--
for Index, TargetMob in pairs(TaggedMobs) do
	DecideAction(TargetMob)
end

Please let me know if you need any more information, thanks.

Perhaps using a WaitForChild instance would work

Already tried it, I still get the same issue, instead to attempting to index nil with Humanoid, it says attempting to index nil with “WaitForChild”

Can you provide a photo of the workspace?

Screen Shot 2020-12-11 at 4.59.54 AM

Let me know if you need anything else

looks really odd, are you inserting values into the table as well by any chance? This shouldn’t happen as collection services GetTagged should either return an Instance that has been tagged or not so it can’t be nil.

When in doubt print

for Index, TargetMob in pairs(TaggedMobs) do
print(Index,TargetMob)
end

Somehow, TargetMob is becoming nil within the table while there is still an instance in it.

I haven’t touched the table at all, but yea It’s really weird, after a bit of messing around it, I found out that yielding the script for a second fixes it. Although I still have some problems after the mob finishes their attack cycle, however that’s most likely an implementation error on my part.

I’m still not sure whats causing the issue.

Update: It seems like I somehow fixed it, I’m assuming it had something to do with the callback functions I had in place not returning the Mob value.

Thanks for the insight tho, I appreciate it