Transferring data from one datastore to another on the same game?

Alright, so I just reworked a custom admin system for a group I am apart of. When doing this, I updated the datastore info because it was still the same as the default, which of course is not recommended. When doing this, I wiped all of the trainer’s aliases. I want to use the new datastore, but I also do not want to make them redo their aliases. This has caused me to wonder, is there a way to transfer data from one datastore to another? I tried searching for an answer but all I found were a bunch of articles and posts about transferring datastores cross games.

I’m not sure if this is what you mean, but you could clone the data inside one DataStore into another easily by just copying the contents over.

DataToTransfer = DataStore1:GetAsync(Key) --if you are saving by UserId, Key would be the user you want to work with's UserId

DataStore2 = DataStore2:SetAsync(Key, DataToTransfer) --Set the value of the second DataStore to the value of the first
5 Likes

If it’s something synced to their userid all you theoretically have to do is check to see if the new datastore has an entry for them, if it doesn’t then check the old data store for an entry. If an entry is found assign it to the player and save to the new data store later on. Or you can do it immediately like shown above.

1 Like