I’ve been searching all over to try and figure out how to make an inventory system like the Roblox game, The Wild West. I have some ideas on how to do certain things but I’m scared that it may not work efficiently and/or work at all. I want it to be lightweight so I need to know the best way to do things.
The system needs to have Item sorting, toolbar limit of 6, item information and types, slot 1 is the only weapon slot and can only be used as a weapon slot (players can’t equip more than 1 weapon at a time), stacking, etc.
I am not asking for specifics or for anyone to code me anything, can anyone just point me in the right direction of how I could do this and keep it efficient or if anyone has useful resources I could use?
Seems like you are mostly worried about efficiency wise rather than how to place the UI in a grid like fashion.
In that case as with all systems start with the data then add the functions to transform it into ui.
The trick to efficiency is to only update the UI when needed.
Start with data in
local inventoryData = {
[gun] = {
weaponType = "Revolver";
itemSlotNumber = 2;
toolbarNumber = nil; --not in tool bar
}
}
local function updateUI(data)
end
updateUI(data)
I see, that makes a lot of sense for efficiency. Do you have any resources I could look at to learn more about ModuleScript usage, as I’m not too familiar with it, but I do know they’re useful.
Also in this case, what exactly would the updateUI function do? I feel like I understand it but I wouldn’t know where to make the actual function to give the player the item/tool so that its not just data. Do I add more onto the data? like lets say, it has access to a folder that stores all the items in the game and each piece of data is matched to an item, then from there the player could be given the item.
Sorry, I just really wanna get it right because its a big thing that could impact gameplay and I’m quite lost.