Attaching tool to viewmodel

Using Headstackk’s method (How do I replicate Real Arm movements to Fake Arms (ViewModel)? ) to create an fps viewmodel, I had ran into problems with attaching the gun to the viewmodel on the client side.
https://gyazo.com/7df894cc9c4635a57d3288383d8e7d06
I later whittled the problem down to conflict between the server script which attached the gun to the player torso, and the local script which attached the gun to the viewmodel. However, after deleting the server sided code, the gun will occasionally fall out of the players backpack, being unable to equip it again, not to mention the guns animation is not properly playing. https://gyazo.com/bbfc34f4731bf84dea6e66ffe436b952
And yes, required handle and can collide is off.

local script

Tool.Equipped:Connect(function()
	CheckConnect = true
	ConnectM6D:FireServer(CheckConnect)
	
	character.Torso.ToolM6D.Part1 = nil -- Remove this when testing viewmodel only

	ViewModelRoot.ToolM6D.Part1 = Tool.BodyAttach
	ViewModelRoot.ToolM6D.C0 = ViewModelRoot.ToolM6D.C0 * CFrame.new(0,0,0)
	
	trackIdle:Play()
end)
Tool.Unequipped:Connect(function()
	CheckConnect = false
	ConnectM6D:FireServer(CheckConnect)
	trackIdle:Stop()
end)

Server script

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function()
		local M6D = Instance.new("Motor6D", player.Character.Torso)
		M6D.Name = "ToolM6D"
	end)
end)

ConnectM6D.OnServerEvent:Connect(function(player, CheckConnect)
	local ToolM6D =  player.Character.Torso.ToolM6D
	local Tool = player.Character:FindFirstChildWhichIsA("Tool")
	if CheckConnect then
		ToolM6D.Part0 = player.Character.Torso
		ToolM6D.Part1 = Tool.BodyAttach
	end
	if not CheckConnect then
		ToolM6D.Part1 = nil
	end
end)