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

My Animation Won't Work, I get LoadAnimation requires an Animation object Error?

Asked by
Borrahh 265 Moderation Voter
4 years ago

The Local Script is in StarterPlayerScripts, the id of the animation is in the animation.

The Error is: LoadAnimation requires an Animation object

Anyone may have any idea what am I doing wrong, I followed a youtube tutorial

wait(3)
local BirdAnimation = script.Parent.animation
local player = game.Players.LocalPlayer
local char = player.Character
local hum = char.Humanoid

local BirdAnimationTrack = hum:LoadAnimation(BirdAnimation)
BirdAnimationTrack:Play()

1 answer

Log in to vote
1
Answered by 4 years ago

they recently deprecated this feature, so you'll have to do it this way

wait(3)
local BirdAnimation = script.Parent.animation
local Player = game.Players.LocalPlayer
local Char = player.Character
local Hum = char.Humanoid

local BirdAnimationTrack = Hum.Animator:LoadAnimation(BirdAnimation)
BirdAnimationTrack:Play()

You will have to include the "Animator" in the humanoid as well.

TIPS

When its an NPC, Insert an "AnimationController" and replace the "Animator" in the script with "AnimationController" because NPC's Naturally don't get animators

Also, this feature can be used in ServerScripts!

0
LoadAnimation requires an Animation object Im still getting this error on the line 7 Borrahh 265 — 4y
0
try to make this into a serverscript using remotefuntions, if its too hard for you, try to insert an "AnimationController" in the Users Humanoid CrazyCats84 154 — 4y
Ad

Answer this question