Quick Question About Player Movement And Animations. Please Help!

I am Just Wondering How I can get My player to play an animation when I rotate him left or right with the mouse?

can’t say I actually checked that this script works but something like this?

 public float mousepos = 0;
 public Animation anim;

void Start()
{
    anim = gameObject.GetComponent<Animation>();
}

    void Update()
    {
    float x = Input.mousePosition.x;
    
    if(x < mousepos) //left
    {
    anim.Play("asdf1");
    }
    if(x > mousepos) //right
    {
           anim.Play("asdf");
    }
    mousepos = x;
    }

if (Input.GetMouseButton(0)){
anim.Play(“animation”)
transform.Rotate(new Vector3(0.0f, Input.GetAxis(“Mouse X”), 0.0f) * -rotationSpeed);
}

depends on what animation it is and how it should behave and interact with other animations.

this is a huge topic, and your question is too generic.

and the answers you gothere are weak obsolete ugly crap.

go look up some animator state machine/mecanim tutorials instead.