Help with custom backpack gui

would you mind explaining to me how you managed to keep each object in its proper slot?