Click to move and facing to move direction?

Hey guys,
So im trying to make a top down game where you click to move, everything is working besides the player doesn’t face the direction its moving properly. Sometimes it just moves backwards towards the place clicked, i was wondering if anyone can see what ive done wrong here, any help is appreciated.

using UnityEngine;
using System.Collections;

public class movement : MonoBehaviour
{
	public Ray ray;
	public GameObject player;
	public Vector3 newPos;
	RaycastHit hit;
	Vector3 moveDir;
	
	
	
	// Use this for initialization
	void Start ()
	{
	
	}
	
	// Update is called once per frame
	void Update ()
	{
		ray = Camera.mainCamera.ScreenPointToRay (Input.mousePosition);
		if (Physics.Raycast (ray, out hit)) 
		{

			if (Input.GetMouseButton (0)) 
			{
				newPos = new Vector3 (hit.point.x, 2.2f, hit.point.z);
				player.transform.position = Vector3.Lerp (player.transform.position, newPos, Time.deltaTime);
				moveDir = newPos;
				moveDir = new Vector3 (newPos.x, 0.0f, newPos.z);
				player.transform.rotation = Quaternion.LookRotation(moveDir * rotationSpeed);
					
			}
		}
	}
}

Your problem is that LookRotation() takes a vector relative to the characters position, not a world point. I’m assuming you are using the ‘2.2f’ to move the hit point up to the level of the character’s pivot. If so, you can fix your code in a couple of different ways. First you could eliminate lines 31 - 33 and replace them with:

player.transform.LookAt(newPos);

Or if you still want to use LookRotation:

player.transform.rotation = Quaternion.LookRotation(newPos - player.transform.position);