Sorting Gui elements within a script

Hello, I am trying to organize a Gui list and add items to the lowest LayoutOrdered UI. I want to check if the Gui has the item in a string Value and if it does then go to the next UI in the list. If it doesn’t then I want it to add the item. I also want it to check all of the items in the list to see if the item exists first. How can I do this?

You can use a table to organize your gui’s from bottom to top

how will I go about doing that?

I will have to insert each slot into the table and then insert the item, position and amount. How will I do this?