Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I'm getting Infinite Yield Possible in output but i don't know why?

player = script.Parent.Parent.Parent

player:WaitForChild('Humanoid').Died:connect(function(respawn)
	print("hi")
end)

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

3 comments

0

Infinite yield possible means that it can't find the object you're looking for!

0

But its an npc does it work the same?

0

If you have an npc you should just check the health, don't use the ondied event

This discussion is preserved as it was. New answers, comments, and votes are closed.