Only one door opens even though each door uses different resourses

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Barrier : MonoBehaviour
{
[SerializeField] GameObject squareParent;
[SerializeField] GameObject square;
[SerializeField] GameObject square1;

public static int Enemykilled = 0;
public int Killrequired;
public static int Enemykilled1 = 1;

void Start()
{
}

// Update is called once per frame
void Update()
{ 
    if (Enemykilled == Killrequired)
    {
        square.SetActive(false);
    }
}

}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Begin : MonoBehaviour
{
[SerializeField] GameObject HELParent;
[SerializeField] GameObject ME;
[SerializeField] GameObject PLZ;

public static int Hi = 0;

public int Killrequired;

void Start()
{
}

// Update is called once per frame
void Update()
{
    if (Hi == Killrequired)
    {
        HELParent.SetActive(false);
    }
}

}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy1 : MonoBehaviour
{
public int health = 100;
public Rigidbody rb;
void Start()
{

}

// Update is called once per frame
void Update()
{
    
}
public void TakeDamage(int damage)
{
    health -= damage;
    if (health <= 0)
    {
        Die();
    }
}
void Die()
{
    Begin.Hi = 1;

    Destroy(gameObject);


}

}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Enemy : MonoBehaviour
{
public int health = 7;
public Rigidbody rb;
void Start()
{

}

// Update is called once per frame
void Update()
{
    
}
public void TakeDamage(int damage)
{
    health -= damage;
    if (health <= 0)
    {
        Die();
    }
}
void Die()
{
    Destroy(gameObject);
    Barrier.Enemykilled++;
}

}

Enemy in the begin dies

  • 1 Hi
    The door needs 1 hit to set object to false
    The second barrier goes down if all the new enemies go down

But every time the first requirement is met the first door is close but the second opens up.