Animation does not stop when a set of new animations loaded

So here it is for reference:

and here is the code

-- Services
local UIS = game:GetService("UserInputService")

-- Variables
local Tool = script.Parent.Parent.Parent.Parent
local Events = Tool:WaitForChild("Events")

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
local Humanoid = Character.Humanoid

-- Shiftlock
local PlayerScripts = Player.PlayerScripts
local Values = PlayerScripts.Values
local IsHoldingTool = Values.IsHoldingTool

-- UI
local PlayerGui = Player.PlayerGui
local MouseIconFolder = PlayerGui.MouseIcon
local WeaponMouseIcon = MouseIconFolder.WeaponMouseIcon

-- Events
local PlayAnimation = Events.PlayAnimation
local ChangeMouse = Events.ChangeMouse
local Shiftlock = Events.Shiftlock

-- Animation Tracks
local AnimationsFolder = Tool.Animations
local jumpAnimation = AnimationsFolder.Jump
local walkAnimation = AnimationsFolder.Walk
local swingAnimation = AnimationsFolder.Swing
local holdAnimation = AnimationsFolder.Hold

-- Functions

local function CharacterAnim(bool)
	if bool == true then -- it says enable the wooden sword walk
		local Animate = Character.Animate
		for DescendantName, DescendantObject in pairs(Animate:GetDescendants()) do
			local counter = 0
			
			if counter < 19 then -- amount of animations
				if DescendantObject:IsA("AnimationTrack") then
					local Animation = Humanoid:LoadAnimation(DescendantObject)
					Animation:Stop()
				end
			else
				break;
			end
		end
		Animate.idle.Animation1.AnimationId = holdAnimation.AnimationId
		Animate.idle.Animation2.AnimationId = holdAnimation.AnimationId
		Animate.walk.WalkAnim.AnimationId = walkAnimation.AnimationId
		Animate.run.RunAnim.AnimationId = walkAnimation.AnimationId
		Animate.jump.JumpAnim.AnimationId = jumpAnimation.AnimationId
	elseif bool == false then -- disable it
		local Animate = Character.Animate
		for DescendantName, DescendantObject in pairs(Animate:GetDescendants()) do
			local counter = 0

			if counter < 19 then -- amount of animations
				if DescendantObject:IsA("AnimationTrack") then
					local Animation = Humanoid:LoadAnimation(DescendantObject)
					Animation:Stop()
				end
			else
				break;
			end
		end
		Animate.idle.Animation1.AnimationId = "rbxassetid://507766388"
		Animate.idle.Animation2.AnimationId = "rbxassetid://507766666"
		Animate.walk.WalkAnim.AnimationId = "rbxassetid://913402848"
		Animate.run.RunAnim.AnimationId = "rbxassetid://913376220"
		Animate.jump.JumpAnim.AnimationId = "rbxassetid://507765000"
	end
end


PlayAnimation.OnClientEvent:Connect(function(AnimationName)
	if AnimationName == "Hold" then
		CharacterAnim(true)
	elseif AnimationName == "Swing" then
		local swingAnimationTrack = Humanoid:LoadAnimation(swingAnimation)
		
		-- Play it bruh lol
		swingAnimationTrack:Play()
		
	elseif AnimationName == "EndHold" then
		CharacterAnim(false)
	end
end)

ChangeMouse.OnClientEvent:Connect(function(MouseIconEnabled)
	if MouseIconEnabled == true then
		UIS.MouseIconEnabled = false
		WeaponMouseIcon.Enabled = true
	elseif MouseIconEnabled == false then
		UIS.MouseIconEnabled = true
		WeaponMouseIcon.Enabled = false
	end
end)

Shiftlock.OnClientEvent:Connect(function(Response)
	if Response == true then
		IsHoldingTool.Value = true
	elseif Response == false then
		IsHoldingTool.Value = false
	end
end)

basically looping through animations and all animations,emotes will stop when its looped but that’s not happening it always wont stop until I jump

You also can stop the animation track by putting: Track:Stop()

its not looped so it will stop eventually

Maybe your animation is too long?

its actually just 2 seconds the swing or maybe even 1 minute

Yeah so try adding Track:Stop() because your animation is long and if you jump the jump animation stops the current animation. So you should try :Stop() if it won’t work lmk!

Like you have to wait 2 sec or 1minute to let the animation stop.