I think your problem is more with the logic.
Supposing the inventory window is visible then line 5 will make it invisible, but then it will drop down to the rest of the code and if there is not an Active Inventory item the inventory window will be visible again.
I think you might get the results you want by putting an "else" after the bracket on line 7.
Supposing the inventory window is visible then line 5 will make it invisible, but then it will drop down to the rest of the code and if there is not an Active Inventory item the inventory window will be visible again.
I think you might get the results you want by putting an "else" after the bracket on line 7.