Roblox's Migration Module Changes to DataStore2 v1.4.0 #203
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Roblox's DataStore2 Migration Module
This Pull Request contains Roblox's official set of code changes to DataStore2 v1.4.0. This Pull Request should not be merged, but rather used as a guide to understand how the new module differs from the original DataStore2.
General Info
This module is a rewrite of Kampfkarren’s DataStore2 Module (DataStore2). However, rather than using the “Berezaa Method” (also known as “Ordered Backups” in the module), it migrates the latest version of data to the “Standard” method of storing data. This migration will only migrate the data of live players, will occur invisibly, and it should have no impact on your experience!
The new module will add a third
SavingMethod
to DataStore2:MigrateOrderedBackups
. This is the new default for the module. It also adds a second setting, beingMigrationDataStoreScope
. This is a scope that is applied to all keys that are migrated; use it to separate your migrated data from any other data you may have in your experience.Guide
To use the DataStore2 Migration Module, first delete the old DataStore2 Module. Secondly, install the package and insert it into your Roblox experience. That’s it! The migration should run out of the box and behind the scenes.
Note: If you made any alterations to the DataStore2 module, you will need to apply those changes to the new module.
Migration
The module will work out of the box. However, read this section if you would like to manually access the data using the Roblox Data Stores API.
The
MigrateOrderedBackups
saving method will move all of your player data into a Standard Data Store with an equivalent name to the combined master key. So, if you combine fields “coins”, exp”, etc. with this code:All of the player data in “coins”, “exp”, etc. will be combined in a table and stored in a Standard Data Store called “DATA”. The key will be the player ID, and the value will be the combined table, as shown below.
If your Data Stores are not combined, then each field will have its own Data Store by that name. So, if the “coins” and “exp” fields were not combined, it would be stored as shown below.
Changing the
MigrationDataStoreScope
will apply a scope to all of the Data Stores migrated to in this module. This allows you to separate them from any pre-existing Data Stores that may have the same name.API
See the DataStore2 API (API - DataStore2)
Note: Use the PatchGlobalSettings method to change the
SavingMethod
or set theMigrationDataStoreScope
. A function call may look like this: