[v1.2.1.1] BetterAnimate (R15, R6, Skinned & Custom Rig Support)

BetterAnimate works like original Animate, but have more functionality


Introduction

As you know, when a player’s character spawns, Roblox creates an inside character script called “Animate”. This script contains information on how characters’s animations should work.
But roblox’s animate script logic and code looking is kinda bad (really bad).

Thats why I decided to rewrite everything


Why BetterAnimate is better?

R15, R6, Skinned & Custom Rig Support

Script automaticly determines which animations should be used for the character by checking Humanoid.RigType


Play custom tool animation

How to use custom tool animation:

local TransitionTime = 0.1
local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://507768375"

local MyAnimator = BetterAnimate.New(Character)
MyAnimator:PlayToolAnimation(Animation, TransitionTime)

P.S Animation Instance will NOT be deleted


Disable Toolnone animation

To disable Toolnone animation (default animtaion when player equip tool), you need to:
Tool:SetAttribute("NoToolNone", true)
OR
Tool:AddTag("NoToolNone")

P.S: You can change Attribute and Tag name that need to check in Settings


Tool speed glitch fix

When you equip tool while emoting your сenter of character mass changes and let to move really fast while jumping (example), with this Animate script it no longer possible

Thanks to @treebee63


Optimized

BetterAnimate using custom timer logic with only 3 event connections:
Humanoid.StateChanged, Character.ChildAdded, Character.ChildRemoved


Inverse animations

To enable this you must set in Settings of BetterAnimate Enabled_Inverse = true

local MyAnimator = BetterAnimate.New(Character, {
	Enabled_Inverse = true
})

-- OR

MyAnimator.Settings.Enabled_Inverse = true
Class_Inverse = { -- Determines what classes have this feature
	Walk = true, 
	Run = true, 
	Swim = true,
	Climb = true,
},

InverseOn = { -- Determines in which direction the inversion will work
	BackwardRight = true, 
	BackwardLeft = true, 
	Backward = true,
	Down = true, -- For climb
},

Update animations in real time

How to use:

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://507768375"

local TestMyAnimations = {
	Idle = {
		Idle1 = {ID = 1132473842, Weight = 1000},
		{ID = 1132477671},
	},

	Toolnone = {
		Toolnone1 = {Instance = Animation}
	},

	Run = { Run1 = {ID = 1132494274, Weight = 10} },
	Walk = { Walk1 = {ID = 1132510133} },
	Swim = { Swim1 = {ID = 1132500520} },
	Swimidle = { Swimidle1 = {ID = 1132506407} },
	Jump = { Jump1 = {ID = 1132489853} },
	Fall = { Fall1 = {ID = 1132469004} },
	Climb = { Climb1 = {ID = 1132461372} },
}

local ResetClass = true -- Means that the current class animations will be deleted

--[[
** NOTE **
if ResetClass = false it will add animations, 
and if found animation with similar index (For example Fall1),
it will be replaced with new one
]]--

local MyAnimator = BetterAnimate.New(Character)
MyAnimator:UpdateAnimations(TestMyAnimations, ResetClass)

Signals

BetterAnimate have 4 Signals:

local BetterAniamte = require(PATH_TO_MODULE)
local MyAnimator = BetterAnimate.New(Character)

 -- Fires on new state (Running, Falling, etc...)
MyAnimator.Signal_NewState:Connect(function(State: string) end)

-- Fires on new animation (Except tool animation)
MyAnimator.Signal_NewAnimation:Connect(function(AnimationClass: string, AnimationName: string, AnimationTable) end)

-- Fires on new **(String not Vector3)** moving direction
MyAnimator.Signal_NewDirection:Connect(function(Direction: string, Vector3_Direction: Vector3) end)

-- Fires on animation keyframe reached (Including tool animation)
MyAnimator.Signal_KeyframeReached:Connect(function(Keyframe: string) end)


Debug

BetterAnimate has a built-in debug that can be activated at any time to check the status

local Enable = true -- or false
local MyAnimator = BetterAnimate.New(Character)
MyAnimator:EnableDebug(Enable)

How to setup
local BetterAnimate = require(--Path_To_BetterAnimate--)
local InitSettings = {} -- You can change it later in MyAnimator.Settings

local MyAnimator = BetterAnimate.New(Character, InitSettings)
MyAnimator:Start()

Q&A
How to get & play avatar animations?
local LocalPlayer = game:GetService("Players").LocalPlayer
local BetterAnimate = require(PATH_TO_MODULE)
local AvatarAnimations = BetterAnimate.GetAvatarAnimationsByUserID(LocalPlayer.UserId)
local MyAnimator = BetterAnimate.New(Character)
MyAnimator:UpdateAnimations(AvatarAnimations, true)

You can get module from GitHub

Module

Or download open source place (Recommended)

Place

Feel free to give feedback

62 Likes

I kinda like what you done here. Might be useful for people who are looking to have a more simple animated script. But my tip is to try and make this work for all avatar sizes as Roblox animated script works on all avatars.

1 Like

My version supports this too, simply it is a modified version of the script from Roblox

2 Likes

Calling /e dance without number argument instead of playing random animation throw error
изображение
изображение

3 Likes

P.S.
You have emotes listed in a dictionary, and it missing dance without number
изображение
and in function PlayRadnomDance


you checking that it it a “dance”

3 Likes

Thanks for report, fixed in new version!

1 Like

Could you please try to improve the R6 Animate script while you’re at it?
That would be nice for my game.

1 Like

Only If I have free time, reading scripts from Roblox is a pain

1 Like

If you tried your 8 directional animation with original “Animate” script then it should work

1 Like

UPDATE 1.0.1
– Added real time changing animations
(If you change Animation’s (walk, run, fall, jump, climb, idle, sit, swim, swimidle) AnimationId in “Animate” script, it will immediately update Animation)
– Some improvements

After some digging, i found that we shouldn’t change animations in real time, roblox animation replication does not support that and i can’t really do anything about it.
(Client-Server view looks different)

Update 1.1
– Added anti-speed tool glitch fix
(If you equip while emoting your сenter of the character changes and player able to move really fast, with this fix it no longer possible)
– Added server script creating non-existing animations (cheer, wave, etc)
– Code logic improvements
– Bug fixes

2 Likes

Update 1.1.0.1
– Added script:SetAttribute() for RunSpeed and AnimSpeed (Can be used for properly crouch / crawl system)
– Small bug fixes

3 Likes

Update 1.1.1
– Added dynamic run/walk animation play
(If player in first person mode or using shiftlock and goes to BackwardRight, BackwardLeft or Backward, animation will be played reversed
P.S if you want to disable it just set If you want to disable it, then set the value of the UseDynamicWalk attribute to false in the script.)

– Rewrited toolnone logic
(I learned that it is better not to store animations in the tool itself, so if you want to disable toolnone animation, then set the “HoldAnim” attribute to the tool (the default value is false))

1 Like

Update 1.1.2

Added R6 Support (yay!)
Weight system now uses SetAttribute (Not Instance.new(“StringValue”))
Removed “Non-repetitive random /e dance” (LocalPlayer.Chatted:Connect() just stopped firing, TextChatService can’t detect “/e dance”)

3 Likes

Update 1.1.3

Added: Real time animation changing (yay!!!) ← Video how to use this

Added: Add/remove animations in real timeVideo how to use this

If you want to set how often animation will be played, use Animation:SetAttribute(“Weight”, YOUR_NUMBER)
1 = Rare,
10 = Often,
20 = Really Often
P.s you can change this Attribute at any time (Default value = 1)

Updated ToolNone logic, to disable ToolNone use Tool:SetAttribute(“NoToolNone”, true)

Replaced all StringValue with Folder (except: pose and mood (you dont even need this)), NumberValue with SetAttribute()

Updated code logic, now its more simpler

Update 1.1.3.1

Added custom Humanoid and Animator name support

Updated LoadAnimation() method, it will use Animator if it exist

CurrentAnimationInstance bug fix

Code is more cleaner

2 Likes

Update 1.1.3.2

Fixed Dynamic run/walk

Updated SetAnimationSpeed()

2 Likes

Update 1.1.3.3

Fixed Swim-Idle animation not playing correctly

Fixed Climb with InverseSystem playing incorrectly
Roblox’s Humanoid.Climbing:Connect() gives positive and negative numbers

Fixed Humanoid.FallingDown:Connect()
Forgot that in my code fall animation working only when you jump

Code cleaning

image

1 Like

Can we have an animation playground game? I’m usually on Mobile and sometimes I don’t have the time to check things on my laptop. Thanks.