Arms snapping up/down when switching tool animations

  1. What do you want to achieve?
    I want the animations when holding the weapon to transition smoothly.

  2. What is the issue? Include screenshots / videos if possible!
    When transitioning the player’s arms snap up and down, like they’re reverting to the default animations for a second before causing it.

Script inside the weapon:

-- Variables --
local Humanoid = game:GetService("Players").LocalPlayer.Character.Humanoid
local animator = Humanoid.Animator
local tool = script.Parent
local animations = tool.Animations
local connections = {}

-- Tracks --
local tracks = {
	idle = animator:LoadAnimation(animations.Idle),
	walk = animator:LoadAnimation(animations.Walk),
	run = animator:LoadAnimation(animations.Run),
	jump = animator:LoadAnimation(animations.Jump)
}
-- Functions --
local function playAnimation(animation, fadeTime)
	for name, track in tracks do
		if name == animation then
			track:Play(fadeTime)
		else
			track:Stop(fadeTime)
		end
	end
end

local function onEquipped()
	-- Play animations depending on state --
	local stateConnection = Humanoid.StateChanged:Connect(function(state)
		if Humanoid:GetState() == Enum.HumanoidStateType.Jumping then
			playAnimation("jump", 0.2)
		end
	end)
	table.insert(connections, stateConnection)

	-- Play idle/walk animations --
	local runningConnection = Humanoid.Running:Connect(function(speed)
		if speed > 9 and speed < 28 then
			playAnimation("walk", 0.2)
		elseif speed > 28 then
			playAnimation("run", 0.2)
		else
			playAnimation("idle", 0.2)
		end
	end)
	table.insert(connections, runningConnection)

	Humanoid:ChangeState(Enum.HumanoidStateType.Landed)
end

local function onUnequipped()
	-- Disconnect all connections and reset table --
	for _,connection in connections do
		connection:Disconnect()
	end
	connections = {}

	playAnimation(nil, 0.1)
end

tool.Equipped:Connect(onEquipped)
tool.Unequipped:Connect(onUnequipped)
  1. What solutions have you tried so far?
    Supposedly using the :Play(fadeTime) is supposed to help or fix this, but in my case, it has not changed what’s happening. I’ve also tried having it start playing the animation before stopping other ones (as opposed to what it does right now, doing both at the same time).

I’m greatly inexperienced in the realm of animation, and I’ve already asked about 3 separate questions here for this one thing alone, so any help or explanations are welcome. Thanks!

1 Like

Posting a little update: This is still an issue - I can’t find any posts that are helpful atm. I am also open to completely different alternatives if this isn’t the way to go about it. Thanks.