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 7 years ago

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

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

2 answers

Log in to vote
0
Answered by 7 years ago

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

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

Basically you forgot to parent the animation on line 6

1local ShootAnim1 =Instance.new("Animation")
2ShootAnim1.AnimationId ="rbxassetid://"..ShootValue
3ShootAnim1.Parent = gun
4-- 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 — 7y
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 — 7y
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 — 7y
0
oh maybe it's because you didn't parent the cloned mp5 to workspace? GameBoyOtaku 63 — 7y

Answer this question