[MODULE SCRIPT] Moon Animator 2 to In Game Animations

[MODULE SCRIPT] Moon Animator 2 to In Game Animations

Hello Roblox developers,

I’m excited to share a new module I’ve created that extends the functionality of Moon Animator 2 for use in cutscenes. While Moon Animator 2 already allows you to export animations for in-game use, it doesn’t support animating multiple objects or characters simultaneously in a game environment. This is where my module comes in!

Demonstration:


How it looks in plugin ↑

How it looks in game ↑


Features:

  • Animate multiple objects or characters at once, perfect for creating dynamic and complex cutscenes.
  • Frame-by-frame control, allowing precise control over animation timing.
  • Looping and playback management, enabling seamless animation flow.
  • Simple API to start, stop, update, and reset animations.

API Overview:

Here’s a brief look at the core functions provided by the module:

new(MoonAnimatorAnimation : StringValue, FrameRate : number) -> AnimatorBase – Initializes the animator with a Moon Animator animation and sets the frame rate.
Start() – Starts the animation playback.
Stop() – Stops the animation.
SetFrame(Frame : number) – Moves the animation to a specific frame.
GetFrame() -> Frame : number – Returns the current frame of the animation.
Destroy() – Cleans up the animator once the animation is no longer needed.

Each animation object is fully customizable and supports timelines for property animation, giving developers the ability to manipulate specific properties of objects frame-by-frame.

Why use this?

This module is particularly useful for those creating cinematic cutscenes in Roblox.
Feel free to check it out and let me know what you think! You are free to use/modify it.

Demo place - MoonAnimator2Players_Showcase.rbxl (125.9 KB)
Asset - Link

70 Likes

This is a lifesaver thanks for making this :slight_smile:

6 Likes

You’re welcome! I am glad that this module will help you.

5 Likes

This is an obvious thing that didn’t still exist for some reason until now. This is a nice feature that saves a couple of hours in development. Thanks

5 Likes

I’ve tried to get this working in my game by cross referencing with the Demo place you provided. In short, I’m experience a bunch of problems. I wish it was easier to just play cutscenes, this is all quite frustrating.

  1. StreamingEnabled (even when using Persistent) causes multiple issues with playing the animation / cutscene. Specifically with loading and accessing parts, models, and rigs. Roblox doesn’t seem to load my Rig on my Custom Characters despite the Model being Persistent.

  2. Disabling StreamingEnabled gives me this Expected BasePart got Model for Model.PrimaryPart. from the Util Module. Having a Model as a Model’s PrimaryPart doesn’t make any sense. I suspect the Util is getting Models for things not in the Animation Save from MoonAnimator as all Models I use in my Cutscene have PrimaryParts (a MeshPart specifically w/ a rig under it):

    • I’ve tried to get around the error by using a Pcall and printing out the error, just ignoring it really in Util, but more errors pop up.
  3. Error: ReplicatedStorage.MoonAnimator2Players.MoonAnimatorPlayer_V2.Util:190: invalid argument #1 to 'ipairs' (table expected, got nil) - Client - Util:190 Maybe the MoonAnimator2Save itself is corrupted or broken?

4 Likes

Hello,

Could you please share your file so I can review it and provide detailed recommendations? Based on my initial observations, there are a couple of points to consider:

  1. You are currently using a folder to contain all your cutscene assets. This approach might lead to issues since you cannot set StreamingBehavior on a folder as you can with a model.
  2. I have not yet tested this workflow with rigged models that include bone constraints, so there may be unanticipated compatibility concerns.

If you’d like to discuss this further, feel free to reach out to me on Discord - doh4x

Edit:
To ensure proper module initialization, it is crucial to wait for all instances within the folder to fully load before proceeding animation. Failure to do so may lead to potential issues. However, an update addressing this concern, including a fix for bone-based rigs, will be released soon.

5 Likes

Update:

  1. Streaming Functionality: Full support for streaming is now available. To ensure this feature to work, please combine your animation assets into a single model and set the model ModelStreamingMode to either persistent or atomic.
  2. Enhanced Compatibility: Added support for models utilizing a bone-based structure.
9 Likes

What are the capabilities of this? Can it play animations with properties other than cframe? Can I select which rig I would like to play animations on, like the player?

5 Likes

I noticed in your test place you had “MoonAnimator2Saves” and I’m wondering how you achieved this? Do you have to set it up manually or is it exported through the plugin? In general, I just would like to know how to configure an animation.

Solved: The file is automatically saved by moon animator in server storage

3 Likes

Update:

Someone asked me to check why a module was throwing errors. Turns out (I’m not an animator and barely familiar with Moon Animator), the camera had two extra properties: LookAtPart and AttachToPart. These aren’t standard Camera properties, so I added a small wrapper to handle them properly.

4 Likes

Update:

Added a Retargeting module.
You can now remap objects inside animations to your own models.
This feature is quite heavy — if your animations have properties tied to ObjectValue, you must preserve the original reference object.
Otherwise, the script won’t be able to match the new objects correctly.

5 Likes

i just edited the json table lol

4 Likes

nice to have a module for this tho

3 Likes

Does anyone know how to fix the error "attempt to index nil with ‘Value’ " on line 63 at timelineBase?

1 Like

it’s likely a problem with the directory string, dm me on discord:coolbulldj

1 Like

Does this module support animation events in Moon Animator?
If not, could you please consider adding it, as it would be helpful for cutscenes.

2 Likes

Update:

  • Completely rebuilt all code, added significant changes for optimization (added cache for timelines).
  • Added new timeline type Bone for working with bone-based rigs.
  • Added new timeline type Event for working with events, works similarly to standard Roblox events for animations (EVENTS WITH CODE EXECUTION ARE IGNORED). To get an event from animation, use the following function:
GetEventSignal: (AnimatorBase, ObjectId: number?) -> Signal
  • Modified the Retargeting module, now it’s less resource-intensive.


Example of event output

  • First name of Event (either manually set name or frame number)
  • Second event output (multiple data fields possible)


Example of usage

Does anyone know how to replace one rig with the player rig at runtime? Im struggling with this
and it would be useful for cutscenes

2 Likes

Looking for rbxl files with Moon Animator 2 animations

I’m testing a module and need rbxl files containing Moon Animator 2 animations for validation. Any animation complexity works - just need diverse test cases to ensure proper functionality.

Drop files (here or on my discord @Doh4x) if you have any available. Thanks.

Can you play moon2 files on any humanoid in-game? I’ve modified a moon2 anim player and edit the json encode string so that I can play it on any humanoid. Works pretty well I’m just curious if this is better than that.