Inconsistent animations' playing speeds

Hi everyone, this is my first time posting here so please bear with me.

I am currently creating a melee combat system and I’ve run into a problem that I don’t really know how to fix. I have 5 animations that are very short in duration and therefore should play pretty quickly in game, but I find that their speed is actually inconsistent: while they play correctly most of the time, some times they are severely slowed down;

This is how the animation looks, the last set of KeyFrames makes it so that after the punch/kick animation has “finished”, the player returns to his idle pose. My goal was to make it so that if a player clicked their mouse slowly, the animations would have time to finish and therefore making their character return to the idle pose, but if a player clicked quickly the animation would get interrupted by the next one before the character has the chance to return to the idle pose. Here’s two gifs to let you understand better:

Slow clicking:
SlowClicking

Spam clicking:
FastClicking

I noticed that the problem tends to happen when the player clicks slowly, playing a new animation when the previously played one is returning to the idle pose, rather than when the player spam clicks.
Here’s a video that clearly shows the problem, as you can see some of the animations are slowed down (I’m sorry for the bad quality and low fps)

This is my local script

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local uis = game:GetService("UserInputService")
local animator = hum:WaitForChild("Animator")

local data = {}
local combo = 1
local debounce = false
local mainCooldown = game.ReplicatedStorage:WaitForChild("mainCooldown")

local a1 = Instance.new("Animation")
local a2 = Instance.new("Animation")
local a3 = Instance.new("Animation")
local a4 = Instance.new("Animation")
local a5 = Instance.new("Animation")

a1.AnimationId =  "rbxassetid://14027589675" 
a2.AnimationId =  "rbxassetid://14027924810" 
a3.AnimationId = "rbxassetid://14028761278"
a4.AnimationId = "rbxassetid://14027924810"
a5.AnimationId ="rbxassetid://14027797082"

local lastUsed = tick()

local anims = {
	 animator:LoadAnimation(a1),
	 animator:LoadAnimation(a2),
	 animator:LoadAnimation(a3),
	 animator:LoadAnimation(a4),
	 animator:LoadAnimation(a5)
}

for i,v in anims do
	anims[i].Name = "Combo"..i
end
uis.InputBegan:Connect(function(input, chatting)
	if chatting then return end

	if input.UserInputType == Enum.UserInputType.MouseButton1 then
		if debounce or mainCooldown.Value == true then return end
		
		debounce = true
		mainCooldown.Value = true
		
		if tick() - lastUsed > 1.6 then
			combo = 1
		end
		lastUsed = tick()	
		for i,v in pairs(animator:GetPlayingAnimationTracks()) do
			if string.find(v.Name, "Combo")  then  v:Stop()  end  --The previous attack animation might still be playing ()
		end
		wait()
		anims[combo]:Play()
		
		
		if combo == 5 then
				combo = 1
				wait(.3)
				mainCooldown.Value = false
				wait(.4)
				debounce = false
		else
				combo +=1
				wait(.2)
				mainCooldown.Value = false
				debounce = false
			end
	end
end)

All of them have a priority of Action4.
I hope someone can help me because I wasn’t able to find anything that could help me

1 Like

For some reason the streamable link downloads the video rather than opening the website, I’m sorry about that. Edit: Uploaded the video directly

1 Like

try replacing the line with
anims[combo]:Play(0,1,1)
also, is there any reason why theyre all Action4 that seems pretty excessive

1 Like

To make sure they play on top of everything, I have some flight animations that have priorities of 2 and 3.

2 Likes

I actually didn’t know those parameters existed, but unfortunately it’s still happening after adding them

1 Like

i know neither did i as of a week ago
you have that wait() right behind it that could be delaying it
ps use task.wait()

Thanks for the advice. I had tried removing that wait, but still no result. The animations are even slower than than on video, not by much but it’s clearly visible

actually change that 0 to 0.5 so that it can fade between the animations, that might sortof remove that delay

anims[combo]:Play(0.5,1,1)

That makes them slower, I am experimenting with other values. Also I don’t know if it matters but I mostly used a cubic InOut easing

1 Like

Couldn’t fix it with fadeTime, the problem persists