Mortor6d welding breaking

Hey guys! im currenlty working on my game, but the mortor6d welding is a bit eh. Here is the code what happens is when you die sometimes it just half welds and gets stuck in your head like this.

Here is the code:
Server:

game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)

local a = Instance.new("Motor6D")
a.Parent = char.Torso
a.Part0 = char.Torso
a.Name = "ToolGrip"

end)
end)

game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)

      local char = plr.Character
      char.Torso.ToolGrip.Part0 = char.Torso
      char.Torso.ToolGrip.Part1 = location


end)

game.ReplicatedStorage.DisconnectM6D.OnServerEvent:Connect(function(plr)
    plr.Character.Torso.ToolGrip.Part1 = nil
end)

In local script in the tool

Gun.Equipped:Connect(function()
     char.Torso:WaitForChild("Motor6D").Part1 = Gun.MainPart
end)

script.Parent.Equipped:Connect(function()        
    game.ReplicatedStorage.ConnectM6D:FireServer(Gun.MainPart)
    char.Torso.ToolGrip.Part0 = char.Torso
    char.Torso.ToolGrip.Part1 = Gun.MainPart
end)

Gun.Unequipped:Connect(function()
    game.ReplicatedStorage.DisconnectM6D:FireServer()
end)

any help loved

BTW this code is based of @Headstackk post of animating tools, guns, etc.