How to fix glitched animations?

I have a tool that upon equipping,deletes the original “animate” located in the character,and inserts my own.
If you Unequip it it deletes the added anims and adds back the orginal “animate”

For some reason if the character is moving or jumping the animations,glitch making animations like the idle of the inserted anims “twitch” or just not animate at all.

Can somebody please help,or point in the right direction?

Can you show us your script please ?

Here it is

Script 1:

tool.Equipped:Connect(function()


	
	local Characters = script.Parent.Parent

	Characters.Animate:Destroy()

	local sa = script.SwordAnims:Clone()
	sa.Parent = Characters
end)

Script 2:


local tool = script.Parent





tool.Unequipped:Connect(function()
	local Players = game:GetService("Players")
	for i,player in pairs(Players:GetPlayers()) do
		--if (player ~= nil) then
		local Character = player.Character
		Character.SwordAnims:Destroy()
		local Animate = script.Parent.SwordGiverAndRemover.Animate:Clone()
		Animate.Parent = Character

	end

end)

Is it in a local script? If so try making it use a remote or just a server script