I have been experimenting with inventories for a game, and almost have one. It does have it's glitches though. Here is how it works: Click an item to add it to your inventory. If the first slot is not being used or is being used by the same type as the item you clicked and is not full, add it. If The slot is full or being used by a different kind of object, it will move on to the next slot and repeat this process until it finds an open slot or runs out of slots. That part works. The problem is that when I click an item, sometimes it will add hundreds to the one slot! I am not sure why it does this or how to fix it, so please tell me. The link is below.
Thanks in advance
Give me a Pixel