why does flip drop speed to -1?

Hi i’m currently coding my character controller and it works fine, How ever there is one problem when i make the character flip using this.

Vector3 theScale = transform.localScale;
theScale.x *= -1;

on the animator for my walk animation walking right goes from 0 speed to 1 which is great but when i go to left and he flips giving -1 on the scale it also puts the -1 on the walk animation speed so he moves left in idle animation.
also i’m not providing the whole code cause i don’t need to i just want to know why scale is affecting the animation speed.

Never mind i fixed it i forgot to do mathf.abs with the animation sorry for wasting you’re time