How to optimize datastores?

My problem is I need to find a way to optimize datastores, I’m very new to data saving since I have never worked on big projects I never found a necessity to learn it.

I’m currently working on a turn based game that will rely on players collecting skills and different classes that boost different playstyles, I’m afraid as progress goes on and more skills and such are added to the game it will become difficult to manage.

I have a few questions that I’d like to get help with to choose the right method for my game, I haven’t really found help elsewhere since it all focuses on how to use datastores and not how to optimize it or use it for big amounts of data

First question - Should the DataStore be in one script or can it be split into multiple scripts? And in doing so, are there risks of dataloss from splitting the saving?

Second question - Is it possible to store something other than values? For Instance, can I store an entire folder or a module script and then re-load it with a datastore?

Final question - Should I use a global scripts to save the data of all players or use one script for each player? Can it cause problems if there are too many datastore scripts? (data loss, lag, etc…)

I’ve looked around other topics but none seem to really answer what I’m looking for so I hope I can find an answer here.

I’ve never worked with datastores so some of these might be freebie questions but I have yet to find an answer for them.

1 Like

1- You should keep them in 1 script.
2- No, you need to take their values and load them back with new instances, you can’t save instances.
3- 1 script can handle every data saving and loading.

Edit: Here is my own data store module, you can use it or take a look at the source code.

2 Likes