rotating character to face arrow keys

EDIT I NOW HAVE ONE SCRIPT sorry about that. I figured out how to combine the two.

all i want is that whenever i press left or right my character turns in that direction instead of strafing as he does. can anyone please help?

public float speed = 6.0F;
public float jumpSpeed = 8.0F;
public float gravity = 20.0F;
private Vector3 moveDirection = Vector3.zero;
private Animation anim;
private CharacterController controller;

void Awake() {
	anim = GetComponent<Animation>();
	controller = GetComponent<CharacterController>();
}

void Update() {
	CharacterController controller = GetComponent<CharacterController>();
	if (controller.isGrounded) {
		moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
		moveDirection = transform.TransformDirection(moveDirection);
		moveDirection *= speed;
		if (Input.GetButton("Jump"))
			moveDirection.y = jumpSpeed;

		if (Input.GetKey(KeyCode.Q)) {
			
			if (controller.isGrounded)
				anim.CrossFade("walk");     
			transform.Rotate(0, -speed, 0);
		}
		if (Input.GetKey(KeyCode.D)) {
			
			if (controller.isGrounded)
				anim.CrossFade("walk");     
			
		}
		if (Input.GetKey(KeyCode.A)) {
			
			if (controller.isGrounded)
				anim.CrossFade("walk");     
			
		}
		
		if (Input.GetKey(KeyCode.E)) {
			
			if (controller.isGrounded)
				anim.CrossFade("walk");
			transform.Rotate(0, speed, 0);
		}
		if (Input.GetKey(KeyCode.W)) {
			
			if (controller.isGrounded)
				anim.CrossFade("walk");
		}
		if (Input.GetKey (KeyCode.S)) {
			
			if (controller.isGrounded)
				anim.CrossFade("walk");
		}
		if (Input.GetKey (KeyCode.Space)) {
			if (!controller.isGrounded)
				anim.CrossFade("jump");
		}
		
		{	 
			if(Input.anyKey == false)
				if (controller.isGrounded)
					anim.CrossFade("idle");
			
		}

	}
	moveDirection.y -= gravity * Time.deltaTime;
	controller.Move(moveDirection * Time.deltaTime);
}

}

all i want is that whenever i press left or right my character turns in that direction instead of strafing as he does.

You could tell the transform to LookAt the point you’re walking toward, but you didn’t like that so let’s try Quaternion.RotateTowards…

// ... your other code omitted...
     controller.Move(moveDirection * Time.deltaTime); // This line you got already.
     LookAtDirection(moveDirection);
}

// Move these variables to the top...
public float degreesPerSecond = 90f;
Quaternion targetRotation;

void LookAtDirection(Vector3 moveDirection)
{
     Vector3 xzDirection = new Vector3(moveDirection.x, 0, moveDirection.z);
     if (xzDirection.magnitude > 0)
         targetRotation = Quaternion.LookRotation(xzDirection);

     transform.rotation = Quaternion.RotateTowards(transform.rotation, 
         targetRotation, degreesPerSecond * Time.deltaTime);
}
// ... your other code omitted...