Coding a conditional wall?

I want to have an invisible wall that disappears after I collect a certain number of pickups, but the code I have doesn’t seem to do anything.

 if (other.gameObject.CompareTag("wall"))
        {
            if (count >= 8)
            {
                other.gameObject.SetActive(false);
            }
        }

Someone please help me with what I’m doing wrong.

Where in your code have you placed these if-statements?
Where do you increment count?

void OnTriggerEnter2D(Collider2D other)
    {

        if (other.gameObject.CompareTag("PickUp"))
        {


            other.gameObject.SetActive(false);


            count = count + 1;


            SetCountText();
        }


        else if (other.gameObject.CompareTag("Rocket"))
        {

            other.gameObject.SetActive(false);

            count += -2;

            SetCountText();
        }

        if (other.gameObject.CompareTag("Latias"))
        {
            other.gameObject.SetActive(false);

            count = count + 3;

            SetCountText();
        }

        if (other.gameObject.CompareTag("wall"))
        {
            if (count >= 8)
            {
                other.gameObject.SetActive(false);
            }
        }

I just dont know what I’m doing wrong.

Debug.Log

void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log("I collided with: " + other.gameObject.name) + ", which has the tag: " + other.gameObject.tag);
        if (other.gameObject.CompareTag("PickUp"))
        {


            other.gameObject.SetActive(false);


            count = count + 1;


            SetCountText();
        }


        else if (other.gameObject.CompareTag("Rocket"))
        {

            other.gameObject.SetActive(false);

            count += -2;

            SetCountText();
        }

        if (other.gameObject.CompareTag("Latias"))
        {
            other.gameObject.SetActive(false);

            count = count + 3;

            SetCountText();
        }

        if (other.gameObject.CompareTag("wall"))
        {
            Debug.Log("When I collided with the wall, the count was: " + count);
            if (count >= 8)
            {
                other.gameObject.SetActive(false);
            }
        }

I’m kinda lost…

Put the Debug.Log statements in there, and see what they print. Either the collision with the door isn’t happening, or it doesn’t have the correct tag, or the count is something else than you believe.

Which one of those it is isn’t possible to spot from your code, but my change will allow you to spot them.

Alright Thanks