What's the best and most effecient way to load and unload animations to the character

Hey Roblox community I’ve been struggling with a big issue lately and its made me rethink everythink I know.
I’ve been researching for days but everything has led me to the same dull conclusion.
In my game I use LoadAnimation on the Animator when a player swings a weapon, or equips the weapon. I was told that if you let the animation finish it will delete by itself.
Not sure how true that is but I believed them and it didn’t work.
So my question is, Is there a way to fully unload the animation from the humanoid after I’m done using?

Currently I use a for i loop that runs through the playing animations of the Humanoid.Animator and stops, turns the loop off, and destroys the track. I don’t think my current method works all to well though.

If you need to delete animation tracks, that suggests a problem with your design. You should load animation tracks only once at the start of your script.

See similar topic.

If this doesn’t solve your issue, please provide your script and any errors so they can be reviewed.

Okay and remember all the weapons have their own script but I need them to run the same animations. Here is one of the first weapons I made and just recently upgraded but it has a similar recipe to all the other ones.

local tool = script.Parent
local handle = tool.Handle
local canSwing = false
local isEquipped = false
local durability = 200
local damage = 20
local swingDB = false
local combo = 1
local lightningFx = false
tool.Equipped:Connect(function()
	isEquipped = true
	local char = tool.Parent
	local player = game.Players:GetPlayerFromCharacter(char)	
	local human = char:FindFirstChildWhichIsA("Humanoid")
	local loadedAnim = human.Animator:LoadAnimation(script.Equip)
	loadedAnim:Play()
	handle.Equip:Play()
	wait(loadedAnim.Length)
	repeat wait() until combo and script.Swing1
	canSwing = true
	loadedAnim = human.Animator:LoadAnimation(script.Idle):Play()
	local combo1 = human.Animator:LoadAnimation(script.Swing1)
	local combo2 = human.Animator:LoadAnimation(script.Swing2)
	local combo3 = human.Animator:LoadAnimation(script.Swing3)

	-- atack
	local isSwinging = false
	local function attack()
		if combo == 1 and not isSwinging and swingDB == false then
			swingDB = true
			isSwinging = true
			combo1:Play()
			handle.Trail.Enabled = true
			combo1:Play()
			handle.Swing1:Play()
			delay(combo1.Length, function()
				combo = 2
				handle.Trail.Enabled = false
				swingDB = false
				combo1:Stop()
				isSwinging = false
			end)
		elseif combo == 2 and not isSwinging and swingDB == false then
			swingDB = true
			isSwinging = true
			loadedAnim = human:LoadAnimation(script.Swing2)
			handle.Trail.Enabled = true
			combo2:Play()
			handle.Swing2:Play()
			delay(combo2.Length, function()
				combo = 3
				handle.Trail.Enabled = false
				combo2:Stop()
				swingDB = false
				isSwinging = false
			end)
		elseif combo == 3 and not isSwinging and swingDB == false then
			swingDB = true
			lightningFx = true
			isSwinging = true
			loadedAnim = human:LoadAnimation(script.Swing3)
			handle.Trail.Enabled = true
			combo3:Play()
			handle.Swing1:Play()
			delay(combo3.Length, function()
				combo = 1
				handle.Trail.Enabled = false
				swingDB = false
				combo3:Stop()
				lightningFx = false
				isSwinging = false
			end)
		end
	end
	local function Unequip()
		canSwing = false

		for i, v in pairs(human.Animator:GetPlayingAnimationTracks()) do
			if v.Name == "Equip" or v.Name == "Idle" or v.Name == "Swing1" or v.Name == "Swing2" or v.Name == "Unequip" or v.Name == "Swing3" then
				v.Looped = false
				v:Stop(.5)
				v:Destroy()
			end
		end
		handle.Unequip:Play()
		isEquipped = false
	end
	tool.Activated:Connect(function()
		attack()
	end)
	tool.Unequipped:Connect(function()
		Unequip()
	end)
	tool.Destroying:Connect(function()
		Unequip()
	end)
	local damageDB = false
	local function onHit(hit)
		if hit and hit.Parent:FindFirstChildWhichIsA("Humanoid") and not damageDB and hit.Parent:FindFirstChildWhichIsA("Humanoid").Name ~= "Humanoid" then
			if not isSwinging then return end
			damageDB = true
			handle.Hit:Play()
			if lightningFx == true then
				damage = damage * 2
				for i, v in pairs(handle.Attachment1:GetChildren()) do
					if v:IsA("ParticleEmitter") then
						v:Emit(3)
					end
				end
				handle.LightningStrike:Play()
				task.delay(handle.LightningStrike.TimeLength, function()
					damage = damage / 2
				end)
			else
				handle.Attachment1.CUTS:Emit(3)
			end
			if hit:IsA("BasePart") and hit.Name == "Head" then
				hit.Parent:FindFirstChildWhichIsA("Humanoid").Health -= damage * 2
				handle.Headshot:Play()
			else
				hit.Parent:FindFirstChildWhichIsA("Humanoid"):TakeDamage(damage)
			end 
			durability -= 5
			wait(.75)
			damageDB = false
			if durability == 0 then
				script.Parent:Remove()
			end
		end
	end
	tool.Weapon.Touched:Connect(function(hit)
		onHit(hit)
	end)
end)

This (for example) should be loaded outside of the function like so:

local toolEquipAnim = human.Animator:LoadAnimation(script.Equip)
tool.Equipped:Connect(function()
	-- ...
	loadedAnim:Play()

Yes but if I did that for every melee weapon its gonna keep loading new variables for every weapon. I need to be able to find the animation inside the player and make varaibles attach to it from the script. So basically I need the weapons to use the same animations and tracks.