Animate2 - More readable Animate script

Animate2 is the Roblox animate script rebuilt from the ground up. It’s designed to be much easier to use, edit and read. Take a look for yourself at the code difference:

Original Animate
function stepAnimate(currentTime)
	local amplitude = 1
	local frequency = 1
  	local deltaTime = currentTime - lastTick
  	lastTick = currentTime

	local climbFudge = 0
	local setAngles = false

  	if (jumpAnimTime > 0) then
  		jumpAnimTime = jumpAnimTime - deltaTime
  	end

	if (pose == "FreeFall" and jumpAnimTime <= 0) then
		playAnimation("fall", fallTransitionTime, Humanoid)
	elseif (pose == "Seated") then
		playAnimation("sit", 0.5, Humanoid)
		return
	elseif (pose == "Running") then
		playAnimation("walk", 0.2, Humanoid)
	elseif (pose == "Dead" or pose == "GettingUp" or pose == "FallingDown" or pose == "Seated" or pose == "PlatformStanding") then
		stopAllAnimations()
		amplitude = 0.1
		frequency = 1
		setAngles = true
	end
Animate2
Humanoid().StateChanged:Connect(function(OldState, NewState)
	if Debug == true then
		print(OldState.Name .. " --> " .. NewState.Name)
	end
	
	StopAllEmotes()
	
	RunAnimation(false, "RunningAnim")
	RunAnimation(false, "ClimbingAnim")
	RunAnimation(false, "JumpingAnim")
	RunAnimation(false, "FallingAnim")
	RunAnimation(false, "SwimmingAnim")
	RunAnimation(false, "SwimmingIdleAnim")
	
	if NewState == Enum.HumanoidStateType.Climbing then
		RunAnimation(true, "ClimbingAnim")
	elseif NewState == Enum.HumanoidStateType.Running then
		if Humanoid().MoveDirection ~= Vector3.new() then
			RunAnimation(true, "RunningAnim")
		end
	elseif NewState == Enum.HumanoidStateType.Freefall then
		RunAnimation(true, "JumpingAnim")
	elseif NewState == Enum.HumanoidStateType.Swimming then
		if Humanoid().MoveDirection ~= Vector3.new() then
			RunAnimation(true, "SwimmingAnim")
		end
	end
end)

Features:

  • Easier to read
  • Works with both players and NPC’s
  • R15 and R6 support (automatic detection)
  • Change the ID and Speed of animations, even at runtime
  • Auto updater for any future updates

Disclaimer:
This script is not guaranteed to include all of the features of the original Animate script. It’s designed to be an easier to read / edit version rather than a direct replacement.


The Animate2 script in action.

Get the script here: Animate2 - Roblox

48 Likes

Honestly this is so much better than the default “Animate” script, very readable and useful! I fully recommend using this over Roblox’s default script!

10/10 | Easy to understand, uses updated signals (Connect vs connect), auto-updated, Preloads Animations, and Pretty-Efficient! :blue_heart:

3 Likes

What do you mean by less realistic?

Update v1.01:

-Minor Bugfix (stops unnecessary warning)
-Animations now stop with a fade time of 0.2 instead of 0.1, so ending your jump should look smoother!
-Includes version number at top of module

Sorry @0MRob to confuse you, it’s just Roblox’s animate script has so much stuff going on with fade times and smoothing it’s really difficult to make it exactly the same. It shouldn’t have any noticeable difference though!

Gotcha! Thanks for the clarification.

Update v1.10

-Now supports sitting animation
-Tool equipped animation and sit animation can now be changed in the config folder
-R6 support! An extra config folder alongside the Animations folder has been added called Animations R6. The module detects what rig type you have, so no need to worry!

Fun Fact: R6 swim & swim idle animations are the same as run & idle.

3 Likes

Update v1.11

-Requiring the module now returns a function that allows a Name parameter, see this in action in the loader script. This means you can require it multiple times if you need more than one animation config (e.g. a levitating fairy and a stooping zombie)
-NPC’s no longer display Idle Animation 2, as it breaks the priorities for some reason
-Loader script has been rewritten to look nicer

Hi is there any way to make a separate walking animation for let’s say 12 walk speed and run = 25 walk speed?

Nevermind, I configured and added it :slight_smile:

You would need a run/walk script for this that handled walkspeed updates yourself, as this is an animate script not a movement script.
Then, every time walk/run is toggled you can update the animation ID’s in the module script.

Nono, I meant the script auto changing the animation on different walk-speeds, I added config for a run and walk speed where you can set the max walk speed to penetrate the run animation.

1 Like

Update v1.12

-Calling the Animate2 module in ReplicatedStorage now takes an extra argument as well as Rig: CustomConfig. This allows you to change the config for each rig you activate. For example:

require(Module)(Rig, {["Debug"] = true, ["AllowEmotes"] = false})

will set Debug to true and AllowEmotes to false for that Rig.

-An extra config value has been added: ChattedEvent. This is useful for if you want to use a chat system that does not use Player.Chatted. This value should be set to a RBXScriptSignal and is used for emote hooks (e.g. /e dance)

-Animation Tracks are now renamed to “LocalAnimation” instead of “Animation”. This allows you to differentiate animation tracks which have been created locally and ones which have been replicated, as all replicated animation tracks are automatically named “Animation” by Roblox.

Mostly technical stuff.

Found an issue with animation replication;
What I see on my Client:

What the Server/Other Players see:

try to disable AnimationWeightedBlendFix under the Workspace properties

Somewhat fixed it?
Now the animations looks correct, but when the idle animation plays, it over-rides emotes on the server end.

How could we run a function in the module, it is all in one big return, but would be nice to get to the functions inside, namely emotes.