|
| 22 Jan 2016 11:11 AM |
I'm making an inventory system and there's going to be hundreds of items. Currently, I have a modulescript which contains all of the item info and stuff and it's in the ServerScriptService, so nobody can mess with it.
All the item models are in a folder in the ServerStorage and when you get a new item it adds a value or folder to your Inventory folder with the name of the item.
How would you sort it? This is really messy.
Would it just be easier to have folders containing all the info of the item in it and putting THAT in the inventory, or would it lag if there's hundreds? |
|
|
| Report Abuse |
|
|
litalela
|
  |
| Joined: 30 Mar 2010 |
| Total Posts: 6267 |
|
|
| 22 Jan 2016 11:14 AM |
just have a table
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2016 11:17 AM |
| a table where and for what |
|
|
| Report Abuse |
|
|
QJD1996
|
  |
| Joined: 20 Jan 2009 |
| Total Posts: 1472 |
|
|
| 22 Jan 2016 11:23 AM |
I don't know how you have your inventory set up, but I'm guessing it's GUI that contains a bunch of boxes...
I'd personally try to do everything on a server script. I'm currently making an inventory system, and I've decided it would be better to have an inventory table for each player, versus a folder. That would just create too much lag.
I'm assuming you are having DataStores with this game. Have a table or multiple tables assigned to each player that contain a serialized version of their inventory. As they add/remove items, the table will add/remove values. When they leave, have a DataStore that gathers all the contents of these tables... then have them reload when the player enters.
Here's what I'd advise: Each item will be represented through an inventory box. Have a table created that contains each box:
table = { box1; box2; box; }
That will be the serialized inventory. When it reloads, the boxes will be cloned from your ServerStorage to the inventory GUI, and the scripts should already been inside them.
Sorry for being so vague, but hopefully you get the point. If you really need help, just message me.
|
|
|
| Report Abuse |
|
|
Zenuvius
|
  |
| Joined: 26 Aug 2014 |
| Total Posts: 551 |
|
|
| 22 Jan 2016 11:27 AM |
Right in front of me so I can flip it !
Use a table for this, put all the "items" in a table so u can pull it out from it when you need it, same goes for inventory and crafting if it exist in your game.
Davidii made a neat crafting/inventory system before and it generally use tables to pull it off.
|
|
|
| Report Abuse |
|
|
litawolf
|
  |
| Joined: 26 Feb 2013 |
| Total Posts: 396 |
|
|
| 22 Jan 2016 11:29 AM |
tab = { {"Iron Sword", { ["Damage"] = 10, ["Durability"] = 100 },
}, {"Empty"}, }
➳Lɪᴛᴀʟᴇʟᴀ ɪs ᴍʏ ɴᴀᴍᴇ, Lᴜᴀ ɪs ᴍʏ ɢᴀᴍᴇツ |
|
|
| Report Abuse |
|
|
|
| 22 Jan 2016 11:40 AM |
alright lit, that's what i'm already doing thanks! |
|
|
| Report Abuse |
|
|