Basicly when you open a GUI from an Item and drop this item all the items in inventory duplicate
My process: I just followed the normal tutorial to make a item that can have an inventory.
Video:
NOW WITH WORKSPACE
Issue comments
Just to let you guys know that duplication is still possible:
best workaround is just to add procedure into gui that checks every tick if player holds given item in hand, if not, close all guis
easiest way to do this is
If: Not: Item in main-hand of (target entity) = (item)
close any GUI open for (target entity)
you could also add "or" after "not" and add off-hand but this will still have a small dupe exploit cuz you can just press F in the inventory to swap items between hands
Just Check if the Item is in the hand. I think it is possible.