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

What is "LoadAnimation requires an Animation object" and why won't my animation load?

Asked by 3 years ago

I have no Idea why this isn't working. I am using an animation for a monster in my game. Also, this is a script and not a local script in case that has anything to do with it.

01local Animation = script.Parent.AnimSaves.Run
02local rig = script.Parent
03rig:WaitForChild("Humanoid")
04local humanoid = rig.Humanoid
05 
06print(Animation.ClassName)
07print(humanoid)
08local AnimTrack = humanoid:LoadAnimation(Animation)
09 
10AnimTrack:Play()

Here is my output:

KeyframeSequence - Server - Script:6

11:06:43.129 Humanoid - Server - Script:7

11:06:43.129 LoadAnimation requires an Animation object - Server - Script:8

11:06:43.129 Stack Begin - Studio

11:06:43.129 Script 'Workspace.Monster.Script', Line 8 - Studio - Script:8

11:06:43.130 Stack End - Studio

1 answer

Log in to vote
0
Answered by 3 years ago

wait nevermind i fixed it

01local Animation = Instance.new("Animation")
02Animation.AnimationId = 'rbxassetid://7100391419'
03local rig = script.Parent
04rig:WaitForChild("Humanoid")
05local humanoid = rig.Humanoid
06 
07print(Animation.ClassName)
08print(humanoid)
09local AnimTrack = humanoid:LoadAnimation(Animation)
10 
11AnimTrack:Play()
0
Please make this the correct answer so other people know this is fixed. CDXKIE 130 — 3y
0
Please make this the correct answer so other people know this is fixed. CDXKIE 130 — 3y
Ad

Answer this question