can not move my enemy with rigidbody

I need my enemy to target the player and move towards the player and attack without moving through walls. My script used to work(everything except moving through walls) but I changed it to try to make the enemy not move through walls and now the enemy won’t move at all. I attached a rigidbody, a character motor, a box collider, and a character controller. Heres my EnemyAI script.

using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {
	public Transform target;
	public int moveSpeed;
	public int rotationSpeed;
	private Transform myTransform;
	public int maxDistance; 
	// Use this for initialization
	void Awake () {
	myTransform = transform;
	}
	void Start(){
	GameObject go = GameObject.FindGameObjectWithTag("player");
	target = go.transform;
	maxDistance = 2;
	}
	// Update is called once per frame
	void FixedUpdate () {
	myTransform.rotation = Quaternion.Slerp (myTransform.rotation, Quaternion.LookRotation(target.position - myTransform.position), rotationSpeed * Time.deltaTime);
	if(Vector3.Distance(target.position, myTransform.position) > maxDistance) {
		rigidbody.velocity = transform.TransformDirection(new Vector3(0,0, moveSpeed));
	}
}

}

Where is movespeed defined, you could be setting velocity to zero on all three axis? Also try not moving objects using their velocity. For rigidbodies you can apply force, or in this case since it should be a constant speed you can move them by lerping their transform’s position.

As for going through walls you will need a collider on the wall as well.