Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago
player = script.Parent.Parent.Parent

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

1 answer

Log in to vote
0
Answered by 6 years ago

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
0
Infinite yield possible means that it can't find the object you're looking for! User#20388 0 — 6y
0
But its an npc does it work the same? Revisedy 23 — 6y
0
If you have an npc you should just check the health, don't use the ondied event User#20388 0 — 6y
Ad

Answer this question