Item Animations Not Working

I’m trying to create an item system using models and Motor6Ds.

It is mostly working but there is a few issues. The main problem is that the animation for equipping the item will not stop playing because it creates a new animation each time an item is equipped or unequipped.

Here is a video of the problem:

Here is the server script for when the player equips or unequips an item:

EquippedRemote.OnServerEvent:Connect(function(player, itemName, isNowEquipped)
	local equipAnim = Instance.new("Animation")
	equipAnim.Parent = script
	equipAnim.Name = "EquipAnim"
	equipAnim.AnimationId = ItemInfo[itemName].EquipAnim
	local unequipAnim = Instance.new("Animation")
	unequipAnim.Parent = script
	unequipAnim.Name = "UnequipAnim"
	unequipAnim.AnimationId = ItemInfo[itemName].UnequipAnim
	local equipLoad = player.Character.Humanoid:LoadAnimation(equipAnim)
	local unequipLoad = player.Character.Humanoid:LoadAnimation(equipAnim)
	if isNowEquipped == true then -- value has been set to equipped
		local clone = game.ServerStorage.Items[itemName]:Clone()
		equipLoad:Play()
		itemequipped = itemName
		clone.Parent = player.Character
	elseif isNowEquipped == false then -- value has been set to unequipped
		--unequipLoad:Play()
		equipLoad:Stop()
		itemequipped = nil
		player.Character[itemName]:Destroy()
	end
end)

I’m aware that for the animation to be able to stop, it needs to be known throughout the whole script, which can be achieved through using a local script but then it wouldn’t be seen by other players in the game.

Also, the animation has a delay, probably because I’m using a RemoteEvent, so I’m hoping to be able to fix that as well.

Hi! I think i’m late, but anyway.

I’m not so smart to explain in detail how it works, but basically, Roblox engine replicate some character data to server. As i know is CFrame and animations.

So you can just put your code into local script and it’ll work

Edit:
Also recommended to use Animator instead Humanoid to load animations, reasons in this announcement: Deprecating LoadAnimation on Humanoid and AnimationController