player = script.Parent.Parent.Parent
player:WaitForChild('Humanoid').Died:connect(function(respawn)
print("hi")
end)
✓ ANSWER ACCEPTED
I'm getting Infinite Yield Possible in output but i don't know why?
1 answer
✓ Accepted answer
Humanoid is not a part from player, you should do this
player.Character:WaitForChild('Humanoid')
Don't forget to test if the character is a character like this
local char = Player.Character
if char then
-- code
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Infinite yield possible means that it can't find the object you're looking for!
But its an npc does it work the same?
If you have an npc you should just check the health, don't use the ondied event