Hold Animation not stopping

Hello I’m writing a script for my gun and this hold anim
Screenshot_12
But Animation:Stop() not working
Screenshot_13

function OnUnequipped()
	


        if FPSHandsEnbled then

		local Rig = DetectRigAsync(MyCharacter)

		if Rig == "R15" then
			local WhitelistedBodyParts = {"LeftHand", "LeftLowerArm", "LeftUpperArm", "RightHand", "RightLowerArm", "RightUpperArm"}
			
			for i, v in pairs(WhitelistedBodyParts) do
				TransparencyConnections[v]:Disconnect()
				TransparencyConnections[v] = nil
			end
		elseif Rig == "R6" then
			local WhitelistedBodyParts = {"Right Arm", "Left Arm"}
			
			for i, v in pairs(WhitelistedBodyParts) do
				TransparencyConnections[v]:Disconnect()
				TransparencyConnections[v] = nil
			end
			
		end	

		if AutoFirstPerson then
			MyPlayer.CameraMode = Enum.CameraMode.Classic
			MyPlayer.CameraMinZoomDistance = 9.6
			task.wait(0.02)
			MyPlayer.CameraMinZoomDistance = game:GetService("StarterPlayer").CameraMinZoomDistance
		end
	end

    
	Handle.UnequipSound:Play()
	Handle.EquipSound:Stop()
	Handle.EquipSound2:Stop()

	local Equip = MyHumanoid:LoadAnimation(script.Parent.Equip)


	LeftButtonDown = false
	flare.MuzzleFlash.Enabled = true
	Reloading = false
	MyCharacter = nil
	MyHumanoid = nil
	MyTorso = nil
	MyPlayer = nil
	MyMouse = nil
	Equip:Stop(0)
	if OnFireConnection then
		OnFireConnection:disconnect()
	end
	if OnReloadConnection then
		OnReloadConnection:disconnect()
	end
	if FlashHolder then
		FlashHolder = nil
	end
	if WeaponGui then
		WeaponGui.Parent = nil
		WeaponGui = nil
	end
	if RecoilTrack then
		RecoilTrack:Stop()
	end
	if ReloadTrack then
		ReloadTrack:Stop()
	end
end

Here is uneqquip code part

You need to use the same AnimationTracks object to be able to play and stop it.

Here you are creating a another AnimationTracks, which means that even if you :Stop() this one it won’t stop the AnimationTracks you created and played in the function for when the tool is equipped

sorry for my poor explanation but i don’t really know how to properly explain this

1 Like

Solution to this problem is to use the same AnimationTracks throughout your script