Datastore questions

So recently I’ve been focusing on datastores and I got those questions:

1- Is there a limit of how many keys I can create in a datastore?

2- Is there a limit of how many datastores I can create?

3- If I were to do a datastore where I use timestamps as keys, Should I do that with ordered data stores or normal data stores (I noticed it is possible)

4- If I do DataStoreService:GetDataStore(player.UserId) can I have some problems?

1 Like

Here are some possible errors that can occur when using DataStores. For your second question, your game may get slower or (DataStores) error occasionally if you make use of too many. Take note that you can store tables in them, so try to do that when and if possible. For your last question, it will error if they are not in the game. Instead, use: game.Players:GetNameFromUserIdAsync().

1 Like

Yes. You cannot go over 260K characters which does influence the amount of keys that can be stored.
No.
Yes. You should use OrderedDataStores for accomplishing that, technically you don’t have to, but for getting the oldest or newest timestamp it’s probably the most ethical.
Yes. If the player is in-game then no, but technically you could create a DataStore for a specific UserId with no issue if the UserId is a string.

game:GetService("DataStoreService"):GetDataStore(tostring(game.Players["Player"].UserId))
2 Likes

Ok so I got another question to do, when using ordered data store to do the timestamp things, should I create a ordered data store per player?

1 Like

Depends on what you’re doing with the data. Like if you want the most recent DataStore from every player, no. I don’t actually understand why you’re creating DataStores per player as that could easily exhaust the server if 5 people join at the same time and you’re gathering data from all 5 of those DataStores.

1 Like

Well I dont really have many ideas of how to do the timestamp thing so I thought creating it to all players…