How to use DataStore2 - Data Store caching and data loss prevention


Try replacing local Inventory = Data:Get() with local Inventory = DataStore2("Inventory", Player):Get(), perhaps there is an issue with caching/differing keys?


In any particular block or both?


Second one.


Still doesn’t work. Might just try recoding it all to see if it fixes ;p


Can you add documentation on how to use ODS with this? Or give me the basic run down on how I would do it. Thanks.


You wouldn’t be able to because of how DataStore2 saves internally, apologies.


Ahhh thanks for the clarification I re-read the documentation multiple times thinking I missed something. So would it be alright if I used a separate ODS alongside Datastore2 or would the rates be hit?


As long as you’re smart about using 1 DataStore2 key (or use combined data stores), no.


Alright thanks for the clarification! Also really loving Datastore2


Is it possible to create a leaderboard with DataStore2? Like in games that shows the top 10 "insert action here"ers ?


As I said before, DataStore2 has no functionality like ordered data stores. It’s best to just use normal ordered data stores for that, sorry.


Rip, might leave a leaderboard out then. Thanks for the fast reply.


If you aren’t doing too many data store calls, you can just read players’ data from DataStore2, and save it to a regular ordered data store.


Been using this on a few of my projects, and I have to say it works great. Never had any issues in the few months of development I’ve been doing. Good stuff!


I’m having a small issue here. I’m trying to check to see if there is a cached value and if not it tells the client to do stuff.

Code below

DataStore2.Combine("MasterKey", "Avatar")
	local Avatar = DataStore2("Avatar", plr)

	if not Avatar:Get({},true)  then
	print('Player has no avatar data')


help is appreciated


Is this really what you want? If you don’t provide a default to Get, it’ll return nil which may be what you want. I don’t see why you’d need to check specifically to see if there’s a cached value in the first place.


To check if its the player’s first time playing by checking if the player has data.


Then just check if the result of :Get() is nil.




Added a little note at the beginning: