Hello, I want to create an Inventory system that has categories and is on the server, the issue is im having difficulties starting and accessing specific things such as which item goes into which slot in a category. What would be the best way for me to approach this?
Create multiple table. or create folder.
local tools = {"FlashLight"}
local drinks = {"Cola"}
Something like that.
Hi there! I think the best way to do it is by using folders. You can make a folder in the player, this will just be the main folder, after that make for every category a new folder, and there you can store the items.
Please note that this can be exploited on the client, so make sure to always check if something is in the folder or any important things on the server.
This isn’t the best way to do it, you can also do it all in one table, like this.
local itemsTable = {
["Swords"] = {
["Item1"] = 50,
["Item2"] = 10
},
["Shields"] = {
["Item1"] = 50,
["Item2"] = 100
}
}
I know that exist, I answer him too fast.
Essentially you’ll need to couple together data about item type/name with data about item category. There’s lots of ways to do it. If you tell us about how you’re currently doing things we can help you figure out how to add categories to your specific approach.
I already have a module which gives the item info like this but I’m just wondering how to make the rest of the inventory system
Can’t really help with that, it’s too broad. But if you have specific questions then ask away
I currently have a table with multiple tables inside of it.
local Inventories = {
Section1 = {}
Section2 = {}
Section3 = {}
Section4 = {}
}
for my item module I reference the type and it is the name of the section.
local ItemModule = {
["Sword"] = {
Type = "Section1"
Stackable = false
--etc
}
}
return ItemModule
I don’t know how I could make a pickup system because I want it to be on the server and then when the player picks up the item I want it to add it to the correct table. I will also need to find out how I could add multiple of the same item even if it is stackable.