DataStore2 Get Question

I have a question about dataStore2.

lets say i have combine(“MAIN”,“Coins”,“Gems”)

So what exactly does dataStore(“StoreName”,player) return?

and if i were to write dataStore(“Money”) what would it return since money isnt one of the ones under main branch? Would it return nil? Or would it make a whole new dataStore with the name money?

Also when doing something like coinStore:Get(dontAttemptGet = true), what will it return if the players coins arnt in cache? Would it return nil?

My third question was answered here:

It returns a DataStore2 instance to call methods like :Get and :Set on.

It would work, but it wouldn’t be optimized under the master key. It would create a brand new data store, and increase the chances of throttling. You should never use a key that is not combined.

Okay thank you!!

You mentioned I could stop the character from loading in the first time, how would I do that?

Turn off Players.CharacterAutoLoads (something like that) and call :LoadCharacter() manually once their data is retrieved, and whenever they die so they will respawn.

1 Like

In my case the player cannnot interact with the game till their data is in the cache.

Would I still need to use the backup function? And What is the best way to use it?

Because from my understanding is it allows the player to play the game without its normal data, but the default data as if they were a new player. My game is a farming game so I woudnt want the player to start from the beginning.

Backup function is never necessary, and I haven’t used it in a production game (and am unaware of anyone who has), so I’m unable to comment on the best way to use it, sorry.

Note that players don’t really “start from the beginning”. It doesn’t reset their data, it’ll prevent any saving until it is assured that it is no longer a backup store.

1 Like