Change the speed of an animation

Is there a way to change the speed of an animation without having to edit it?

15 Likes

Yes, there is! You can adjust the speed of an AnimationTrack (An animation after it is loaded by the Humanoid) by using the :AdjustSpeed(float) function.

An example would be:

local Animation = script.Animation
local Humanoid = script.Parent.Humanoid

local AnimationTrack = Humanoid:LoadAnimation(Animation)
AnimationTrack:AdjustSpeed(0.5) -- Would play the animation 2x slower
AnimationTrack:Play()

Hope this helps!

63 Likes

Can you do this while the animation is playing?

To change the speed of an animation in Roblox, you can use the AnimationTrack object and its Speed property. The AnimationTrack object represents an animation in a Roblox animation file and contains information about the animation, such as the animation’s length and the bones or objects that it affects. The Speed property determines how quickly the animation plays, with a value of 1.0 being the default speed and higher or lower values representing faster or slower speeds, respectively.

Here is an example script that will change the speed of an animation:

Copy code

local player = game.Players.LocalPlayer local character = player.Character local humanoid = character:WaitForChild("Humanoid") local animationTrack =humanoid:LoadAnimation(game.Animations.Animation1) animationTrack.Speed = 2.0animationTrack:Play()

First, we create variables called player and character and set them to the local player and the local player’s character, respectively. Then, we use the WaitForChild method to wait until the character has a Humanoid object, which is the object that controls the character’s animations.

Next, we use the LoadAnimation method on the Humanoid object to load an animation from an animation file. In this case, we load the Animation1 animation from the game.Animations object, which represents the animation files in the game. We store the AnimationTrack object representing the animation in a variable called animationTrack .

Then, we set the Speed property of the animationTrack object to 2.0, which will make the animation play at twice the default speed. Finally, we use the Play method on the animationTrack object to start playing the animation.

You can customize this script to change the speed of different animations or to use different methods to load or play the animations, such as using the Animation object or the PlayAnimation method on the Humanoid object. You can also use other properties of the AnimationTrack object, such as the Looped property to control whether the animation loops or the WeightCurrent property to adjust the blending of the animation with other animations.

4 Likes

does this also change when an event marker is reached?

Yes, I believe you can. charss

This doesn’t seem to be working for me

local VaultAnim = Instance.new('Animation')
	VaultAnim.AnimationId = "rbxassetid://17103423106"
	local AnimationTrack = plr.Character.Humanoid:LoadAnimation(VaultAnim)
	AnimationTrack:AdjustSpeed(plr.Character.Humanoid.WalkSpeed * 0.1)
	AnimationTrack:Play()

I don’t know if this is just deprecated or what but i really need it to work.
And it doesn’t give out any errors
And i have tried it without it being set to the Player WalkSpeed.

try to play it and then change the speed

5 Likes