2D game unity player flip problems

Hey,
I have a question, I hope u can help me
I want to change the players X Scale then my player turns around weird… see image
X = 0.5 : Screenshot by Lightshot
X = -0.5 Screenshot by Lightshot

My flipping Code is :

if (facingRight == false && moveInput > 0)
 {
     Flip();
 }
 else if (facingRight == true && moveInput < 0)
 {
     Flip();
 }

private void Flip() { facingRight = !facingRight; Vector3 Scaler = transform.localScale; Scaler.x *= -1; transform.localScale = Scaler; }

thank you for helping me

Position your sprite so the image is central to the parent. The pivot point of the sprite is at the corner and if that is positioned to the parent’s origin it will cause the offset of the character.