Animation not playing fully

Hello! I am working on a lightsaber game, but one of the animations is glitching, script:

local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=10237736463" --Animation ID
local track
tool.Equipped:Connect(function(mouse)
	local animation1 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
	local animation2 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation2)


    track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
	track.Priority = Enum.AnimationPriority.Idle
	animation1.Priority = Enum.AnimationPriority.Action
	track:Play()
	mouse.Button1Down:Connect(function()
		local random = math.random(1,3)
		if random == 1 then
			animation1:Play()
		elseif random == 2 then
			animation2:Play()
		end
	end)
end)
tool.Unequipped:Connect(function(mouse)
	local animation1 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
	local animation2 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation2)
    if track then
		track:Stop()
	elseif animation1 then
		animation1:Stop()
	elseif animation2 then
		animation2:Stop()
	end
end)

The second swing animation buffers and does not fully play, my videos won’t upload.

Any help is appreciated!

You’re stacking AnimationTrack instances by loading the same Animation instances multiple times, try to limit/restrict the loading of each unique Animation instance to once.