markjac
(markjac)
March 31, 2019, 2:35am
#1
I’ve been trying to make an inventory system for weapons and items.
I am having trouble with getting the items into the inventory GUI. Such as how would adding a new item to the inventory know what position it should have if there is a already x amount of items in the inventory.
This is probably the biggest problem I have. Once I get this main issue solved I’m positive I could do the rest
So any tips or ideas on how to do this.
2 Likes
Use UI constraints to position them (UIGridLayout | Documentation - Roblox Creator Hub ) , also have a template for each item, and have it Clone the template,etc for each tool.
Multiple threads have this question, please search before making your own thread.
Here is a few threads that I responded my solution to,
While the OP doesn’t understand MetaTables (therefor it may be best he doesn’t use them) I would have to disagree with this. One of the main uses of a metatable is when you’re going to be indexing a class, in this case an Inventory should be unique to each user and if you want to make your life easy then you could set up a MetaTable like I did in this example.
local Inventory = {}
local InventoryClass = {}
local Inventories = {}
function InventoryClass:AddItem(Item, Amount)
local itemName = …
You’re a beginner, therefor this isn’t exactly something you should start with as something like this could be difficult for moderate or even good scripters, especially adding security to this as well.
Now lets say you really want to pursue this (even as a beginner) how should you go about it? From my experience making an inventory is really just inserting in to a table and then reading that table. So lets say we have an inventory table named “Inventory”
Inventory = {};
This inventory table w…
3 Likes