How to add information onto a save file instead of overwriting?

I have a simple inventory / market system where the purchase of the item, the item’s ID is saved and passed onto the inventory which reveals the button by making it visible.

Obviously this is not working as intended, because whenever I purchase a new item the new item’s ID is now the only visible item and the previous item is now back to invisible. Is there a way I could make it so that when the new item is purchased the ID is added to the previous ID save and now tow item ID’s are visible? Like an incremental save of sorts? Or any other alternatives? I’m sure I’m completely missing something here, any help will be appreciated!

The inventory would usually be an array, and then when the array changes loop over it and update visibility as you have.

Thanks for the reply. How do you mean to ‘loop over it’? Are you talking about the “For Each Loop” function?

Well, the inventory is ‘arrayed’ and then given an ID for the array. The ID is what should determine the visibility of the inventory button. In my screenshot example I’m simply assembling the array manually. Each button goes into the array to get an array ID.

Yep so in your screenshot you get an integer ID. But usually an inventory would be an array of IDs. Then you could for each loop of each ID in the array and run your logic for setting visibility

1 Like

I think I understand what you’re saying. Might have to report back. Thanks!!