you need to pick a specific inventory slot not just hope itll pick an empty one
It doesnt matter how an inventory of any size is displayed to the players inventories are simply arrays
Dont think of your inventory in terms of this object is this slot and this item goes in this slot. Thats all just visual representation of the data in the array
if you have 6 inventory slots then you need an array of length 6. array position 0 = slot 1 ... array position 5 = slot 6
Store the info of the ITEM in the array position of the slot its in. To display that to the players create graphical objects to show thats contained in the array
Once your that far then you need to make sure you know which visual inventory slot object belongs to which spot in the inventory array. Id use an instance variable on the inventory slot object. Maybe even a family instance variable. With only 6 slots you could use globals too but I wouldnt advise it
Place 6 inventory slot objects in the game however you want. Assign each a number matching a slot in your inventory array (0-5) and THEN when you check for slots to use you can use the instance var to tell which slot it was that was clicked or whatever.
This will give you a working visual inventory but it WONT give you any management of it. Youll have to do that yourself once the rest is in place. Youll have to make sure the array position doesnt have anything in it before adding a new item to it. Youll have to control moving from one slot to another and/or switching positions with other objects.
But the basis for all that will be in place if you go with what Ive said here