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

Humanoid is not a descendant of game?

Asked by 7 years ago

http://i.imgur.com/uCncN1E.png

That's the error, and that shouldn't be possible in the local script as everything else works except animations. But it exists and I don't know how to get rid of it.

Many people have this issue but nobody knows how to fix it based on the amount of searching I've done.

Here's the code:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")

local RunningTrack = Humanoid:LoadAnimation(RunHolder:WaitForChild 'RunAnim')
RunningTrack:Play()

Any solutions?

0
adding while not Humanoid:IsDescendantOf(game)do Humanoid.AncestryChanged:wait()end before line 5 might fix this. 1waffle1 2908 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Try this, if it doesn't work, lmk:

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character:WaitForChild("Humanoid")
local RunAnim = -- Define your Animation here
local RunningTrack = Humanoid:LoadAnimation(RunAnim)
RunningTrack:Play()
0
Actually, the solution I got was to use :InvokeServer() to define the objects since Workspace was referenced locally. Objectly 49 — 7y
Ad

Answer this question