Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

What's the best structure for a custom inventory?

Asked by 5 years ago

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!

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. Fifkee 2017 — 5y

1 answer

Log in to vote
0
Answered by
Bellyrium 310 Moderation Voter
5 years ago

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.

Ad

Answer this question