Inventory system

Hello! I have string values for my inventory system. If say the player has two apples and one banana, theres a folder in the player instance called “inventory”. Inside there there are two string values named “Apple” and their value is “” and another string value named “Banana” and its value is also “”. Now, the gui does calculations and shows how much of each item you got. If you dont have it then i wont show like a real inventory system. But now when you have more inventory like thousands then the gui script takes a LONG time to update the gui. So should I change it into one int value for each item and the value is how much of that item they got?

1 Like

Yes, you should change it if possible. If that doesn’t work then you can also try instance attributes. Currently the way your inventory works is extremely inefficient

Yeah, changing it to Int values will definitely help you with your problem. Also if you haven’t already, you can only change the item that actually changed instead of the reloading the entire inventory.

For example with a loop, then you can use the function Object.GetPropertyChangedSignal('Value') and connect it do the change event handler.

Use ModuleScripts with dictionaries in them for an inventory system.

As others have said above me, there is probably a more efficient route where you don’t use BaseValues. Although, if you absolutely wanted to, I’d recommend using IntValues. Name the IntValue the items name and the Value of it could be the quantity.

yup, thats what i chose to do. thx