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

LoadAnimation requires the AnimationController object to be a descendant of the game object?

Asked by 6 years ago

LoadAnimation requires the AnimationController object (MP5.AnimationController) to be a descendant of the game object?

local Gun=game.ReplicatedStorage.GunStorage.MP5:Clone()
local Controller=Instance.new("AnimationController")
local ShootValue=game.ReplicatedStorage.GunValue.MP5:WaitForChild("ShootingAnim1").Value
local ShootAnim1 =Instance.new("Animation")
ShootAnim1.AnimationId ="rbxassetid://"..ShootValue
ShootAnim1.Parent=Gun
Controller.Parent=Gun
local LShootAnim1=Controller:LoadAnimation(ShootAnim1)
0
You're supposed to load the animation onto the Humanoid, not an AnimationController. Mayk728 855 — 6y
0
stop @iiMayk GameBoyOtaku 63 — 6y
0
so anyone knows what wrong :(? Mr_MilkysButler 47 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago

LoadAnimation requires the Humanoid object (MP5.Humanoid) to be a descendant of the game object? umm...

local Gun=game.ReplicatedStorage.GunStorage.MP5:Clone()
local GunHum=Gun:WaitForChild("Humanoid")
local Controller=Instance.new("AnimationController")
--
local ShootValue=game.ReplicatedStorage.GunValue.MP5:WaitForChild("ShootingAnim1").Value
local ShootAnim1 =Instance.new("Animation")
ShootAnim1.AnimationId ="rbxassetid://"..ShootValue
--
ShootAnim1.Parent=Gun
Controller.Parent=Gun
local LShootAnim1=GunHum:LoadAnimation(ShootAnim1)
0
Ignore the comments Mr_MilkysButler 47 — 6y
0
you forgot to parent the animation controller GameBoyOtaku 63 — 6y
0
line 10 Mr_MilkysButler 47 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Basically you forgot to parent the animation on line 6

local ShootAnim1 =Instance.new("Animation")
ShootAnim1.AnimationId ="rbxassetid://"..ShootValue
ShootAnim1.Parent = gun
-- Parent the animation?

The animations do need to be in the game for them to work

Another EDIT

The more I look at yours it makes me think because I don't think you can load animations onto a object that isn't in workspace.

0
oh I'm dumb didn't read it all the way XDDD GameBoyOtaku 63 — 6y
0
Hey GameboyOtaku, have you inserted an animation to a gun, if you had, can you tell me how you did it?, thanks! Mr_MilkysButler 47 — 6y
0
yes I did in my game which is using the same thing you are doing I had a humanoid in the gun and did it like that GameBoyOtaku 63 — 6y
0
oh maybe it's because you didn't parent the cloned mp5 to workspace? GameBoyOtaku 63 — 6y

Answer this question