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

LoadAnimation requires the Humanoid object to be descendant of the game object?

Asked by 4 years ago
Edited 4 years ago

error : LoadAnimation requires the Humanoid object to be descendant of the game object


local Players = game:GetService("Players") Players.PlayerAdded:Connect(function(Plr) Plr.CharacterAdded:Connect( function(char) print(char) local Hum = char:WaitForChild("Humanoid") print(Hum) Hum:SetStateEnabled(Enum.HumanoidStateType.Dead, false) DeathAnim = Hum:LoadAnimation(script.Parent.Reset) Hum.HealthChanged:Connect( function() if Hum.Health <= 0 then DeathAnim:Play() end end ) DeathAnim.Stopped:Connect( function() Hum.Health = 0 Hum:SetStateEnabled(Enum.HumanoidStateType.Dead, true) end ) end) end)

Gives error. Char > my username char.Parent > nil how to wait for character happen in workspace dont know, wait() on start somehow stops script

EDIT : you need to wait for character to appear in workspace, char.Parent is nil so humanoid isn't in game object, cant load animation, how to fix that idk

0
whats the error? Luka_Gaming07 534 — 4y
0
The error is that she/he didn't insert a cooldown for the humanoid to load in. Geobloxia 251 — 4y

1 answer

Log in to vote
0
Answered by
Geobloxia 251 Moderation Voter
4 years ago

Try putting a wait(2) after the CharacterAdded function to wait for the character (which contains the humanoid) to load in.

0
Its not going to make it work. bcuz HE is litteraly waiting for the Humanoid to load Luka_Gaming07 534 — 4y
0
don't you see Char:WaitForChild("Humanoid") ? Luka_Gaming07 534 — 4y
0
I did Geobloxia 251 — 4y
0
But Char:WaitForChild("Humanoid") isn't working Geobloxia 251 — 4y
View all comments (2 more)
0
But Char:WaitForChild("Humanoid") isn't working Geobloxia 251 — 4y
0
Oh and I got it right. :) Geobloxia 251 — 4y
Ad

Answer this question