Why does this stop working after reequiping the tool?

So i want to animate my knife viewwmodel but when i reequip the tool i use the vmodel on (so destroying the viewmodel and putting it back to camera) it stops working.

Heres the script (local in starterplayerscripts)

local replicatedStorage = game:GetService("ReplicatedStorage")
local players = game:GetService("Players")
local player = players.LocalPlayer
local bayonetSwingEvent = replicatedStorage["Bayonet RE"].BayonetSwing
local viewModel = workspace.CurrentCamera:WaitForChild("ViewModelBayonet")

local animator = viewModel:WaitForChild("Humanoid"):WaitForChild("Animator")

local bayonetAnimation = Instance.new("Animation")
bayonetAnimation.AnimationId = "rbxassetid://119909123885850" -- Bayonet swing animation

local walkAnimation = Instance.new("Animation")
walkAnimation.AnimationId = "rbxassetid://109707052357654" -- Walk animation

local bayonetAnimationTrack = animator:LoadAnimation(bayonetAnimation)
local walkAnimationTrack = animator:LoadAnimation(walkAnimation)

bayonetSwingEvent.OnClientEvent:Connect(function()
	bayonetAnimationTrack:Play() 
end)

local humanoid = player.Character:WaitForChild("Humanoid")

humanoid.Running:Connect(function(speed)
	if speed > 0 then
		if not walkAnimationTrack.IsPlaying then
			walkAnimationTrack:Play()
		end
	else
		walkAnimationTrack:Stop()
	end
end)