Problem with changing animations using int values

So I have a problem with a possible Unity animation problem. I made an (int) in the animator parameter. In the code, I assigned the int values as idle=0, walking=1, jumping=2.

However, everytime I load the game, it starts fine, with the state (int) value being 0 (which means it’s idle). However once I started moving left or right, the int value immediately switches to 2, but the character should be walking, not jumping. I don’t think it’s the transition problems in the animator, since they should be set correctly (I double checked). It probably is something to do with the code.

This is the whole code, which programs the character’s movements.
I followed this tutorial: Multiple Animations | Build a 2D Platformer Game in Unity #5 - YouTube
I am just a beginner, so help is really appreciated

The problem is on Line 55, you’ve written:

if(rb2.velocity.y > .1f) ;
{
   state = MovementState.jumping;
}

Note the semicolon ; after the if statement. That immediately ends the if statement, then proceeds to run whats meant to be the content of the if statement regardless.
So all you need is to remove the Semicolon:

if(rb2.velocity.y > .1f) 
{
   state = MovementState.jumping;
}

Welcome to the world of programming, where everything breaks because of 1 misplaced character.

It is worth noting that Visual Studio has underlined it in green and I’m assuming is giving you a warning because it can tell you probably didn’t mean to do that.