UI sub categories and show/hide

I am trying to use top to open and close my inventory, and to go back to the inventory by closing a subcategory.

TAB opens my inventory which holds the buttons that open the subcategories. When a subcategory is created it will remove the inventory trough A and the subcategory will take it’s place. It then sets the Boolean to true at B2 after being added to the viewport. When TAB is pressed again, it will read true and remove whichever subcategory is open. Then sets the Boolean to false and remakes the inventory. When TAB is pressed again it should go to B, it instead resets itself and goes for A creating a duplicate.

Here is the problem: Everytime the branch reads false, it resets my flip/flop at C. It always starts at (A) which leads my inventory to be duplicated and will never close (original remains on screen/duplicate is removed) How do I fix the flip/flop, or how do I bypass it. Or should I use a completely different code?

PS: The missing part of the blueprint couldn’t fit. It is unrelated. Only sets mouse control.

So I did some tinkering and I saw an error in my subclasses of the UI (I copied them from the main inventory UI to not having to replicate all fonts and styles of my text) and it turned out I also duplicated it’s code. I removed that. I also changed the flipflop with another if branch. Both things should be perfect now (in theory). Yet I am still having the exact same problem.