Problem with reducing points

I am working in a C# script that will reduce 1 to my weapon’s ammo everytime the player press the left mouse button. I got no errors, so i think everything is fine, but when i test the game it only reduces one time, not everytime. So if i say that my ammo is 5, when i shoot it reduces to 4 and then it doesn’t reduce the ammo anymore.

That’s the script i am using

 public GameObject txt;
    private int ammo;
    public int bullets;

    void Start()
    {
        ammo = bullets;
        UpdateAmmo();
    }


    void Update()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            ammo = bullets - 1;
            UpdateAmmo();
        }
    }

    void UpdateAmmo()
    {
        txt.GetComponent<UnityEngine.UI.Text>().text = ammo.ToString();
    }
}

Because your not actually reducing your ammo… “bullets” seems to be what is your actual ammo count, and all your saying is, “whatever the number is for ammo… Show that, but like, just show 1 number less”, your not affecting the actual value “bullet” is. So what youd want to do is change ammo = bullets - 1; to something more like bullets -= 1; ammo = bullets; that way your actually updating bullets.

You will also run into the problem that, once your bullets hit 0… It will start to go into the negative numbers, if you DONT want that, then contain that idea into a if-statement, something like: if(bullets > 0){bullets -= 1; ammo = bullets;

Hope that helps.