AnimateController - Modular Animate script for tool animations & more!

GET THE MODEL HERE

AnimateController is a module to replace the Animate script without all the bloat, support new animations (such as landed and, for R6, swimming and running) and, most importantly, support tool animations.


Information


Examples

All examples above come from my game Elemental Legacy.


Notes

  • Don’t try to change any values from the returned AnimateController directly. Use the methods instead to assure nothing breaks.
  • The script removes the default emotes system as it’s designed for games who have (and most do) their own emotes system.
  • The animations in the video aren’t public, they are mine and set by me; they don’t come with the model. Roblox already offers some default animations, but Landed, LandedRoll, Swim, SwimIdle, and Run needs to be set by you.
  • Although the Idle animation is set to a Folder containing animations by default, you can delete it and use only a single Animation instead.
  • In the tool animations showcase, the tool models aren’t named Handle nor parented to the Tool itself. The script does not rely on a supposed “Handle” when there’s a properly named animation under the Tool. You can use your own tool handle equipping logic and just set the animation.
  • Although I don’t have any examples of uses of tool idle, walk, and run, they are still a feature! Due to the custom tool holding, I personally never need a custom idle/walk/run because the tool holding mixes with the default idle/walk/run, but an example would be a “Boxing” Tool that plays a custom boxing stance idle animation.

If you have any suggestions for QOL, features, or performance, please comment!

2 Likes

v1.0.1

  • Added a version indicator at the top of the script.
  • Changed RegisterAnimation to only support an Animation as its first parameter and added an “overrideName” parameter.
  • Small changes to other parts of the script.
  • Made Jump play with Movement priority instead of Action.
1 Like

MAJOR UPDATE - v1.1

As said before, I’d turn this into a module. It’s now named AnimateController. The post was updated with all the functions in the new module.

  • I am sure that it works in R15 now.
  • With the module, parent it to ReplicatedStorage and require in an Animate script to start using it.
  • Added an AnimateParams; a table approach for the old “Script Attributes”.
  • You can now modify animations in real time. Useful for games that modify default animations when a character is in a specific state.
  • A default Animations is set when the object is created; this way, if you happen to modify default animations and then want to return to default after a certain state is removed from a character, you can use the new ResetToDefaultAnimations method.
  • It’s now possible to use this to load NPC animations in the client.
  • Increased default LandedDuration to 0.6.
1 Like

Nice module will be taking a look at it later on.

how would one go about making it so an animation alternates when doing multiple jumps and whatnot

For my game I currently have it so the player has some base animations (Walk, Idle, Jump)
There are also different dash and Run animation that can be changed
and there are also animations (Running w/ a tool, idle w/ a tool, jumping w/ a tool) that will be played when a certain type of tool is equiped (Projectile, katana, long sword, short sword)

How would one go about making it w/ ur module (if u can provide a detailed example or an example baseplate file would be best)

1 Like

how would one go about making it so an animation alternates when doing multiple jumps and whatnot

I think you can do that by changing the Jump animation to a Folder and adding several jump variations in it. You can also set their weighted chance with an attribute to the animation as said in the post.

For my game I currently have it so the player has some base animations (Walk, Idle, Jump)
There are also different dash and Run animation that can be changed
and there are also animations (Running w/ a tool, idle w/ a tool, jumping w/ a tool) that will be played when a certain type of tool is equiped (Projectile, katana, long sword, short sword)
How would one go about making it w/ ur module (if u can provide a detailed example or an example baseplate file would be best)

There are some examples in the post and some explanations in the READ_ME and Example scripts in the model, but indeed a more direct explanation is better.

This is a replacement to the default Animate script, therefore it’s only for animations that are related to HumanoidStateTypes, so changing your dash animation would be on your end. About run, I show an example of how you’d code it in the post:

Finally the tool animations. Simply add Animations under a Tool (or ObjectValues that reference an Animation). It should look like this:
image
Or this:

As I said too, there’s another option named ToolHolding which sets a custom holding animation for that tool. It’s what the examples in the post use for tool animations. It will play while running or walking or standing, so it’s an easy way to set up some kind of custom walk/idle/run animations.

v1.1.1

  • Fixed ResetToDefaultAnimations not working due to referencing the same table as Animations, which would cause DefaultAnimations to be changed when Animations also was.
  • Changed the auto fill in AnimateParams being fixed. Now it just detects your Humanoid’s RigType and choose one of the options to use as fill in.