How do i make it so when you click a weapon it goes in your slot, as well as armor?

So how do i make a weapon or armor whenever you click it go in your inventory?

Make a new frame for the item and then put the image in the frame, maybe?