LocalScale not working idealy

Hi, so I just want a basic code which makes my enemies flip when they face a new direction. I was messing around with this here and got it to flip, but when it flipped, it got unproportional. If you could help me I’d greatly appreciate it!

This is the game when they are weirdly messed up:

And when they are normal:

Here’s the code for it:

	public bool FacingRight = true;
	public float rightSize = -1f;
	public float leftSize = 1f;

		void Update ()
		{
				if (transform.rotation.eulerAngles.z > 90 && transform.rotation.eulerAngles.z < 270 && FacingRight == true) {
						transform.localScale += new Vector3 (0, leftSize, 0);
						FacingRight = false;
				} 
				if (transform.rotation.eulerAngles.z < 90 && FacingRight == false) {
						transform.localScale += new Vector3 (0, rightSize, 0);
						FacingRight = true;
				}
				if (transform.rotation.eulerAngles.z > 270 && FacingRight == false) {
						transform.localScale += new Vector3 (0, rightSize, 0);
						FacingRight = true;
				}
		}

Thanks!

You are adding to the localscale when you do

transform.localScale += new Vector3 (0, leftSize, 0). 

Instead, if you want to flip the scale you probably want to assign it a value like

transform.localScale=new Vector3(xScale, yScale, zScale)

If you want to flip the y scale then you would do

transform.localScale=new Vector3(transform.localScale.x, -transform.localScale.y, transform.localScale.z)