In a game of mine, i save a lot of data for the Player and i was wondering if saving too much data can lose you some Data, because i am currently running into this issue, i was thinking that if i maybe switch to buffers the issue could be resolved?
I save data during run-time, so no Data is saved when the Player leaves.
I do this because in the past i also lost Data because i was saving it all once the Player left.
Roblox’s DataStore has a 4MB limit per key and enforces rate limits, so exceeding these can result in lost data. Frequent saving can also trigger throttling, causing some saves to fail since the system does not guarantee every save will succeed. Additionally, relying solely on runtime saving without handling shutdown properly can lead to data loss if a server crashes or a player disconnects unexpectedly.
Oh sorry i kind of said “save on run-time” wrong, i write to my Data on run-time but ProfileStore doesn’t just save on every write, it saves every few mins and on leave, but good to keep in mind.
So the 4MB limit, is there a way to check that? And do you think buffers are a good alternative option?
That’s a lot of data. Maybe split that up or look for ways to cut things down. You could always create “tables” that are not so long like 1 = Shovel, 2 = Light…
Maybe someone that has made one this big would know more.
I can’t check the actual size without knowing Make_Enemy_Default_Data() would output, but excluding it, the template’s size is 813B, just 0.02% of the storage limit.
Even if you have lots of values stored in the user’s data, it is extremely unlikely that you would reach the limit.
(I checked the size by JSONEncoding the table, then checking the length of the resultant string. As 1 character = approximately 1 byte, I can then calculate the storage usage of the table)
If you are running into the datastore limits, you will get errors (although ProfileStore probably catches them, but surely it still emits a warning or an error of its own)
If you aren’t running into errors, then you could have an issue in your implementation of ProfileStore, that is causing your dataloss
Also you likely aren’t reaching the 4mb limit, 4mb is a lot
Buffers would complicate your code for no real benefit