Opening an inventory Screen

Hey guys, I’m working on making an inventory screen that pops up and pauses the game in the backround, heres what I have.

In one class named Inventory I have this boolean

static boolean inventoryOpen = false;

obviously when that value is false that means that the inventory is closed.

and if it is false than the game should run like normal in my gameloop, you can see that on line 24.
The problem I’m having is that even though if I change “inventoryOpen” to true or even leave it at false, the game is just paused right from when I first launch it.

 public void run() {
    //initialize
    Background.initialize();
    Background.entityAdder();
    //------------------------
    addKeyListener(this); 
    double lastGameplayTime= System.currentTimeMillis();
    double now;
    double counting = 0;
    
    while(running)
    { 
      //this enables frame skipping
      now = System.currentTimeMillis();
      if(now>lastGameplayTime){
        counting=0;
        while (now>lastGameplayTime)
        {
          counting++;
          if(counting>=10){
            lastGameplayTime=System.currentTimeMillis();
            break;
          }
          if(Inventory.inventoryOpen=false){
          for(Entity a: Background.entities) //this loop executes each action in the entities array in the background class.
            a.Action();
          lastGameplayTime+=gameplayFrequency;      
          }
        }
        repaint();                         //this refreshes the screen
      }
    }
    now=System.currentTimeMillis();
    if(now>lastGameplayTime){
      try {Thread.sleep((long) (now-lastGameplayTime));}
      catch (InterruptedException e) {e.printStackTrace();} 
    }
  }