I need clarification on DataStore limits

The game I’m working on requires the player to create a server where each server stores tons of data, including every player data that joined the server and other data like NPC’s location, etc…

My current understanding of the datastore limit is that you can have infinite keys, but the value of each key is capped at 4MB.

So my question is, what if the value of the key is a table. Below is an example of what I mean.

local ServerStructure = {
	Player_Data = {
		["Bob"] = {
			Currency = 0;
			Inventory = {};
			Status = {};
		};
		
		["John"] = {
			Currency = 0;
			Inventory = {};
			Status = {};
		};
	}
}

Is the John key capped at 4MB or, is the Player_Data key capped at 4MB?

I believe it would be “Player_Data” but I could be wrong. But you really don’t have to worry about it going above 4MB.

Each key in a Datastore has a 4MB limit, a Datastore key refers to the key used in functions like GetAsync and SetAsync. Every character takes up 1 byte, it’s extremely unlikely that you will ever hit the 4MB limit.

5 Likes

I literally meant every player data in 1 datastore. Not a seperate datastore for each individual.

This is a bad idea, do not do this. There is 0 reason to do this at all.

1 Like

4MB (4,000,000 bytes which typically translates to 4,000,000 characters) per DataStore key as has been stated.

6 Likes