Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer

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!

2 comments

0

LoadAnimation requires an Animation object Im still getting this error on the line 7

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

This discussion is preserved as it was. New answers, comments, and votes are closed.