Animation ender not working properly?

Im trying to end animations before the next one players, but it isnt stopping the animation? any help?

function AnimEnder(Humanoid)
	local emotenames = nil
	for _,anim in pairs(Humanoid.Animator:GetPlayingAnimationTracks()) do
		print(anim.Name)
		for i, emotenames in pairs(game.ReplicatedStorage:WaitForChild("EmoteNPCs"):WaitForChild("EmoteNPC"):GetChildren()) do
			if emotenames:IsA("Animation") then
           if anim.Name == emotenames.Name then
			print("stopping " .. anim.Name)
			anim:Stop()
		   end
		   end
		end
	end
end

Are you naming the animationtrack AFTER you load it?

local animationTrack = animator:LoadAnimation(anim)
animationTrack.Name = anim.Name

No so I ended up changing it around a little bit and got it working, but it only stops one before returning false, how would I make it still stop all the animations before returning?

function EmoteEnder(humanoid)
			for _,anim in pairs(humanoid.Animator:GetPlayingAnimationTracks()) do
				print(anim.Name)
				if anim.Name == "Goner" or anim.Name == "TakeTheL" or anim.Name == "KneelRespect" or anim.Name == "BowRespect" or anim.Name == "PirateRun" or anim.Name == "Worm" or anim.Name == "Bobbin" or anim.Name == "Griddy" then
					print("stopping " .. anim.Name)
					anim:Stop()
					return false
				else
					return true
				end
			end
		end

Name the animation tracks after the animation names, then you won’t have to return at all and it’ll run as desired