How to make an inventory system

Greetings,

I am trying to make an inventory system for my game (it’s like the steam platform, where you have all sorts of items). But I don’t know how to make the inventory to have the items placed in free spots and not be doing it to work mechanically. How can I make it so that the items go in the free spots and the inventory saves? Thanks.

2 Likes

You could save the players inventory as a string and use :split() or you could save it as a table. From the way you asked the question I assume you have like 10 pre-made slots for each item and you are placing each item in the slots, but the better way to do it is you could loop through the player’s inventory and create or clone a slot and display the information.

2 Likes

Hey,

If you know steam (the platform itself), then you probably know the inventory menu. I don’t know how to use the :split() , or to do tables. I am a beginner and I am trying to learn this stuff, so an example would be greatly appreciated. I am trying to make an inventory type like steam since my game is similar to the platform. Pages of inventory slots and more of them appear as you fill them.

1 Like
for i, item in ipairs([Player inventory]) do
      local clonedSlot = [Slot Ui]:clone()
      clonedSlot.Parent = [Frame]
      —Use the inventory data to display the player’s data

      —Example:
      clonedSlot.itemName.Text = item
end

I do not use Steam, sorry.

Tables
Datastore

4 Likes

1 hour tutorial.

2 Likes

Thanks a lot! (character limit)

1 Like