Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

What's the best structure for a custom inventory?

Hello,

I have created an inventory script before where the player had a folder in them called 'inventory' and in that inventory was StringValue's that represent the item name along with multiple int values respresenting damage,health,armor blah blah blah.

I have seen other people storing data strictly in tables inside of the code. Other people store the actual items in a Backpack or other folder.

If anyone has any insight on this perhaps with previous experience on their own inventory script, that would be cool to hear. Thanks!

2 comments

0

I just use multiple stringvalues to store different types of inventories (and levels and such). I dunno if that's bad practice, let me know if it is.

1 answer

From what I can tell, using ValueInstances apose to storing the value in the script is only slighlty more expensive. However I would use a nested dictionary and keep it in the code, as it would be lighter and allow for inventory saving. If you can build a good system with string patterns, its my favorite way. Much smaller functions and easier to manipulate multiple values at once.

This discussion is preserved as it was. New answers, comments, and votes are closed.