Hello everyone,
I have made a module for my game that does save file related stuff.
It loads the players data when they join [the data is a table with all their stuff in it], then there is operations in the module [Get
, Set
, and Increment
] for handling that data when the player is in the game.
(For example, if I had a table like this:
{ test = { a = 5 } }
and I used :Get(UserId, 'Test/a')
, it would return 5.
So all of that works fine, the real problem is how to store it during the session.
Currently, I have tried these methods:
StringValues with JSON
Everytime a player joins, a stringvalue is created under the module. Whenever a GET is called, it decodes the JSON value inside the stringvalue and then returns that.
This worked fine, however it was quite slow; and stringvalues have a max of 200k characters.
Folders with Value Instances
Instead of JSON, this utilizes a different module and converts the player’s save table into a Folder with values inside of it. This also worked ok- it was pretty fast; but it got pretty laggy when overwriting stuff (setting tables inside the file would have to recreate that entire folder. keep in mind im doing many operations per second here.)
Storing Tables Inside the Module
This would have been a perfect solution (storing the save files in the module as Module.Files), as it is fast and not laggy. HOWEVER, usually the file just disappears out of the module when I use it from a different script or Network.
Can someone please help me find a good solution? Also, I have to keep this style of storing/editing files. My entire game is already built around it.
Thanks,
doctorpepper126