LoadAnimation requires the Humanoid object despite Humanoid being in WorldModel

Currently having problems with animating characters in ViewportFrames. Here is the code:

        local currentChar = Player.Stats.EquippedCharacter.Value
		local Char = MakeCharacter(currentChar)
		Char.Parent = newVP.WorldModel
		
		if Module.Animations and Module.Animations.Idle then
			local anim = Instance.new("Animation") do
				anim.AnimationId = Module.Animations.Idle
				print(Char, Char.Humanoid)
				print(Char.Parent)
			end
			local track = Char.Humanoid:LoadAnimation(anim)
			track.Looped = true
			track:Play()
		end

The output would give me this error everytime

image

Even though the character exists, and is in the WorldModel, it’s acting as if it isnt? Any help would be appreciated.

Is that the entire script? If not, could I see all of it?

You can’t use animations on ViewportFrames, per the wiki.
Instead, try setting the part CFrame to the animations. This may be extremely performance intensive, so please be aware of what you use this for.

See this post for more information–

Fixed it! I set up the animation before parenting the Viewportframe!

        local currentChar = Player.Stats.EquippedCharacter.Value
		local Char = MakeCharacter(currentChar)
		Char.Parent = newVP.WorldModel
		
        newVP.Parent = Frame

		if Module.Animations and Module.Animations.Idle then
			local anim = Instance.new("Animation") do
				anim.AnimationId = Module.Animations.Idle
				print(Char, Char.Humanoid)
				print(Char.Parent)
			end
			local track = Char.Humanoid:LoadAnimation(anim)
			track.Looped = true
			track:Play()
		end

@ViserLizz Roblox recently introduced WorldModel which allows you to replicated physics and perform raycasts in ViewportFrames

That’s cool! Thanks for informing me, I will have to look into this!