Tips to a datastore for a tycoon game

So basicly the datastore i have right now works for the Tycoon system but its not the best way.

What i mean by that, is, i have a folder thats containg the names of each object u can buy a script later inserts bools for the objects to a player folder named (Objects Bought) and when u purchase something the bool will be set to true on the object with the same name as the bool with basicly makes the save work.

So the issue with this is that each object i make new i need to make like what i have now models (No children) to store the names but it can get alot messy if i have 75+ buttons or so.
since then i will have 75+ models(No children) so basicly any tips or ideas on what i can do to solve this so i dont need to do that basicly.

I have looked on the devforum and found some solutions but didnt understand them right so what i saw is by tables u insert the names to a table and didnt get the datastore for that and idk if this is the way to go so i made this post for it

Just saying again I am not asking for full scripts for the datastore just on what i need to do and to get a better understanding

1 Like

Can you clarify what you mean, is this for storage within the game instance itself or to save data between game instances for each player?

its to save instances for each player basicly models

Okay, so yes the table storage option is a very good option.

One option is to have a global server script to detect when a new player joins. This script would then call upon a module script to manage a table for that player’s instance within the game. If you have 6 players for your tycoon you can define 6 table objects within the module. As the module would remain persistent throughout the instance of the game it would be idea. Another reason to use a modulescript is that can call reusable functions from other scripts…

For example you could create a function called “boughtObject” and that function would require an input of what table to use / what object was bought. It would then proceed to add that object to the table.

By using tables to store what objects have been bought you can add the name using table.insert(table, “objectname”) or if you want to specify what position the object should be inserted at (if that’s relevant to how your game would function) you could use table.insert(table, pos#, object) so table.insert(table, 10, “objectname”)

Ref: