Rotate the player so he always face forward

Hello, I was developing a third person controller where the player moves using animation(Root motion).
I want my player to always look forward. here is my current script with nothing useful.
Thanks in advance.

private Animator PlayerAnimation;
private float MoveX;
private float MoveY;
public Transform CamLoc;

public float moveSpeed;
public float rotationSpeed;

public Transform relativeTransform;

void Start()
{
    PlayerAnimation = GetComponent<Animator>();
}

void Update()
{
    MoveX = Input.GetAxis("Horizontal");
    MoveY = Input.GetAxis("Vertical");
    Vector3 movement = new Vector3(MoveX, 0, MoveY);

    MovePlayer(MoveX, MoveY);
}

void MovePlayer(float movex, float movey)
{
    PlayerAnimation.SetFloat("MagX", movex);
    PlayerAnimation.SetFloat("MagY", movey);
}

i think that you had to capture the mouseY and the mouseX

mouseX += Input.GetAxis("Mouse X");
 mouseY -= Input.GetAxis("Mouse Y");

then apply those variables to the rotation transform of your character
and with that, character will always face forward, i guess