Stop Incrementing

void OnTriggerEnter(Collider ammo){

			if (ammo.gameObject.tag == "AmmoUp") {
			
			bulletleft += 50;
			Destroy (GameObject.FindWithTag("AmmoUp"));

     	}else if(bulletleft == 135) {
			Destroy (GameObject.FindWithTag("AmmoUp"));
		
		}

	}

what i want is if the player collide in object with tag Ammo Up it will add a 50 bullets in his magazine. well that’s happen. but my problem is when it’s reach the amount of 135 it still incrementing like 185. what i want if its reach the 135 it will stop from incrementing… sorry for bad english and wrong spelling

void OnTriggerEnter(Collider col)
{
if(col.tag == “AmmoUp”)
{
if (bulletsLeft == 135) //this will prevent AmmoUp to get destroyed in case no bullets can be added
return; //remove it if this is not intended behaviour
else if(bulletsLeft <= 135-50) //checks if it is possible to add 50
bulletsLeft += 50;
else //if not it sets it to default 135
bulletsLeft = 135;

            Destroy(col.gameObject);    
        }
    }

That should do it, of course there are other ways to do it that s a quite simple one. Your code doesn’t work because it will always evaluate if(ammo.gameObject.tag == “AmmoUp”) to true when colliding with an AmmoUp obj thus the else if() will never get reached in this senario but it will be when colliding with other objects. Also do not use Find functions especially when you have a direct reference to the object you want to manipulate. Cheers, if that is not clear enough ask away!

Ps: i am assuming this code is attached to the Player Obj.