Knock Back enemy in 3D space

Hi so I am working on a 3D first person shooter for coding practice. I want to have my enemies be knocked back after they hit you, because I am worried that if the player has knock back they could be knocked into other enemies.

The problem I am having is I can’t get the enemy to reliably be knocked back. I have tried solutions that have been suggested on other threads and it has not worked properly (as they are not knocked back but in a specific direction, like to the right). So I am wondering if it is how I have gone about programming the enemy them self that is the problem.

{
	public Transform Target;
	public float enemyMoveSpeed;
	Rigidbody TheRigidbody;
	public GameObject Body;
	public float waittime;
	public float myMoveSpeed;


	// Use this for initialization
	void Start () 
	{
		//You need this or you get the null refrence exeption error
		TheRigidbody = GetComponent<Rigidbody>();
	}
		
	
	// Update is called once per frame
	void Update () 
	{
			transform.LookAt (Target);
			TheRigidbody.AddForce(transform.forward*enemyMoveSpeed);
	}

	void OnCollisionEnter (Collision col)
	{
		if (col.gameObject.tag == "Player") 
		{
			Debug.Log ("HiHi");
			TheRigidbody.velocity = Vector3.back*myMoveSpeed;
			StartCoroutine(Bounce());
		}
	}

	IEnumerator Bounce()
	{
	yield return new WaitForSeconds(waittime);
	}	
}

Thank you any help is appreciated.

Have you tried adding a backwards force to the RigidBody in the direction of the velocity instead of changing the velocity directly (see Rigidbody.AddForce)?

This way you will let the RigidBody handle the velocity change instead of setting it manually. Try with ForceMode.Impulse or ForceMode.VelocityChange in your case.

 void OnCollisionEnter (Collision col)
 {
     if (col.gameObject.tag == "Player") 
     {
         TheRigidbody.AddForce(TheRigidBody.velocity * -1, ForceMode.Impulse);
         StartCoroutine(Bounce());
     }
 }

Hope it helps!