Game doesn't play the same after building then in the editor

My problem is I have a player controller script with a boolean that the player can move. This determines if the play can move or not. When they press the inventory key, it opens up the inventory. When opening the inventory, it sets that boolean to false. In the editor this works fine, the player can’t move while in the inventory. However, when I build the player can move while in the inventory. Why does it work in the editor, but not when I build the game? Any feedback is helpful, thanks for reading!

make developer build and check if it still happens

    tick developer build