SpriteRenderer.flipY not functioning

The problem I’m having is that my script, which has access to the spriterenderer on my gameobject, won’t flip the sprite when I directly type "sprite.flipY = true;" at the end of my FixedUpdate() function.

        if (transform.position.x < player.transform.position.x)         {             facingright = false;         }         if (transform.position.x > player.transform.position.x)         {             facingright = true;         }         sprite.flipY = !wasfacingright; 

Heres all of the code if you need it

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class GunController : MonoBehaviour {     public Transform player;     public CharacterController2D playercontroller;     public float smoothness = 0.125f;     public float winglength = 2;     private Vector2 difference;     private bool facingright = true;     bool wasfacingright = true;      public GameObject bullet;     public int maxammo;     public int ammo;     public Transform rightNozzle;     public Transform leftNozzle;      public SpriteRenderer sprite;     public Sprite normalGun;     public Sprite emptyGun;     public GameObject emptyBottle;     public Animator reloadAnim;     // Start is called before the first frame update     void Start()     {         player = transform.parent.transform;         sprite.sprite = emptyGun;     }      // Update is called once per frame     void Update()     {      }     private void FixedUpdate()     {         doMovement();         tryShooting();         tryReloading();     }     private void tryReloading()     {         if (Input.GetKey(KeyCode.R) & ammo <= 0)         {             Instantiate(emptyBottle, transform.position, Quaternion.identity);             StartCoroutine(reload());             ammo = maxammo;         }     }     private void tryShooting()     {         if (Input.GetMouseButton(0) & ammo > 0 )         {             ammo -= 1;             if (facingright)             {                 Instantiate(bullet, rightNozzle.position, transform.rotation);             }             else             {                 Instantiate(bullet, leftNozzle.position, transform.rotation);              }          }     }     private void doMovement()     {         wasfacingright = facingright;         if (transform.position.x < player.transform.position.x)         {             facingright = false;         }         if (transform.position.x > player.transform.position.x)         {             facingright = true;         }         sprite.flipY = !wasfacingright;         if (wasfacingright != facingright) { playercontroller.Flip(); }         difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;         float rot = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;          Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition) - player.position;         pos.z = 0;         Vector3 desiredpos = player.position + (winglength * pos.normalized);         Vector3 smoothpos = Vector3.Lerp(transform.position, desiredpos, smoothness);         transform.position = smoothpos;         transform.rotation = Quaternion.Euler(0, 0, rot);     }     IEnumerator reload()     {         sprite.sprite = emptyGun;         reloadAnim.Play("Reload", 0, 0);         yield return new WaitForSecondsRealtime(0.5f);         sprite.sprite = normalGun;     }     public void die()     {         gameObject.SetActive(false);     } } 

My game view