Moon Animator Car animation

Hi there! So what I am trying to achieve is a car animation will be played, and the animation is triggered by a script. The thing is, I animated the car with moon animator and was able to export the animation, but now I don’t exactly know how to trigger that animation in-game nor do I know the script on how to achieve this. Please note that I rigged the model, and used easy weld to create 5 “Motor6D” parts, all 4 of them being for the wheels and the last one being for the Body. The primary part of the car model itself is a part called “CarPart” which has one of the 5 Motor6D parts called Body. So what I’m basically asking for is a play animation for a vehicle, not a character model.

Never tried this before, BUT if you add a Humanoid in the car, you could add the Animator inside the Humanoid and LoadAnimation() on it.

1 Like

Essentially, all animations will follow this very basic format, and then you expand from here based on how you want to execute animations
local animation = Instance.new("Animation") animation.AnimationId = animationID -- The rbxassetid typically local animationTrack = car:WaitForChild("AnimationController"):LoadAnimation(animation) animation:Play() -- If looped, call animation:Stop() when you want it to end

The only difference between this and a humanoid animation is, you have to insert an “AnimationController” Into the model, this takes the place of a humanoid (This can be added the same way you add a part in explorer)

I have been using AnimationControllers for a long time now, they are perfect for custom non-player rigs such as cars, catapults, creatures, etc.

1 Like

Please let me know if I did this correctly as this is all very new to me:

Make the AnimationController a child of the car model itself, it takes the place of a Humanoid and must be placed like one.

And yes that should work to just instantly play the animation with no other activation, and go ahead and move "animation.AnimationID = " to the next line, and same with Animation:Play() That was my bad on formatting

Hierarchy:
Car:

  • PrimaryPart
  • Script
  • AnimationController
  • Other parts
1 Like

I tried the fixed method but for some reason I’m getting a error message saying, “Invalid animation id: unknown AssetId protocol”

Animation.AnimationId = "rbxassetid://1434543" -- replace my numbers with your numbers

1 Like

Yes it worked, but now it says Play is not a valid member of animation and by the way I had to change animation to Animation which fixed most of the errors.

Its AnimationTrack:Play(), I should have specified, still new to scripting support

3 Likes