Can data be lost if i save too much data? (ProfileStore)

Hello everyone!

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? :thinking:

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.

(If more info is needed i can provide more)

Here is my Profile Template for anyone wondering:

local Profile_Template = {
    Fully_Loaded_All_Data = false;
	Bee_Data = {};
	Buffs_Data = {};
	Inventory_Data = {};
	Shop_Data = {
		"Shovel";
		"Stash"
	};
	Equipment_Data = {
		["Stash"] = true;
	};
	Quests_Data = {};
	Currency_Data = {
		Honey = 100;
		Pollen = 0;
	};
	Questline_Data = {};
	Hotbar_Data = {};
	Collector_Data = "Shovel";
	Zones_Data = {};
	Codes_Data = {};
	Player_Leave_Time = os.time();
	Enemy_Data = Make_Enemy_Default_Data();
	Event_Quests_Data = {
	};
	Cosmetics_Data = {
		Capacity = 5;
		Cosmetic_Storage = {};
	};
    Wild_Token_Data = {};
	Settings_Data = {
		Pollen_Text = true;
		Background_Music = true;
		Sound_Effects = true;
		Auto_Jelly_Enabled = false;
		
		Auto_Jelly = {
			Until_Legendary = false;
			Until_Epic = false;
			Until_Rare = false;
			Until_Glorified = false;

			Ignore_Legendary = false;
			Ignore_Epic = false;
			Ignore_Rare = false;

			Ignore_Glorified = false;
			Ignore_Bees = {};
			Until_Bees = {};
		};
		
		Sound_Settings = {
			Music_Volume = 1;
			Sound_Effects = 1;
		};
	};
};`

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.

1 Like

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

Hmm okay thanks, if you can could you create a representation of how much 4MB would be here?

Enemy_Default_Data, just makes a very small table with only a few keys with number values, so i don’t think it would amount to much, very interesting that the Template is just 0.02% of the storage limit.

And how do you think i could also pin point where are my implementation problems? If that is possible.

[Mar 23 2025 01:09:33] GamesDatabase1
GamesUpdated: 30
GamesAdded: 0
GamesRemoved: 0
GamesStored: 2242
DataSize: 63KiB

These are logs from one of my games, and in that game, I’m storing basic information about roblox games, in roblox datastores

So, with 2242 games stored, I’m at 0.063% of the 4MiB limit (This notation is 1KiB = 1024 bytes, same as KB, but then kB is 1000 bytes, …, it’s confusing)

The information being stored is this
image
The numbers are compressed into base 92 (datastores can only save 93 of the 256 1 byte characters, and I use “_” as a data separator)
So we are talking about 30 bytes per game stored, which is probably quite a bit less than what a player in your game would consume, but then your player’s data is not being saved 2000 times in the same datastore, and even if it was, you’d have leftover space


As for what the issue could be, you haven’t provided enough information for anyone to help. You need to post your scripts that are relevant (post more than needed, as some people will assume the issue cannot be there or there, but it ends up being somewhere they didn’t post), and then we can start helping

I will also say that getting people to help you about a library, like ProfileStore, will be harder because a lot of people (me included) are not familiar with it

Thanks for the reply! I just found what the problem was, it was just an implementation error like you said, but still very interesting that such little data is still being used, but it’s good to always minimize data usage.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.