Skip to content

Roblox's Migration Module Changes to DataStore2 v1.4.0#203

Draft
LLOR3NZ-RBX wants to merge 1 commit intoKampfkarren:masterfrom
LLOR3NZ-RBX:master
Draft

Roblox's Migration Module Changes to DataStore2 v1.4.0#203
LLOR3NZ-RBX wants to merge 1 commit intoKampfkarren:masterfrom
LLOR3NZ-RBX:master

Conversation

@LLOR3NZ-RBX
Copy link

@LLOR3NZ-RBX LLOR3NZ-RBX commented Dec 9, 2024

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, being MigrationDataStoreScope. 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:

DataStore2.Combine("DATA", "coins", "exp", ...)

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.

DATA DataStore
--------------
[player id] =>  {
                "coins": [value],
                "exp": [value],
                 ...
              }

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.

coins DataStore
---------------
[player id] => [value]

exp DataStore
-------------
[player id] => [value]

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 the MigrationDataStoreScope. A function call may look like this:

DataStore2.PatchGlobalSettings({
    SavingMethod = "SavingMethodGoesHere",
    MigrationDataStoreScope = "ScopeGoesHere"
})

@LLOR3NZ-RBX LLOR3NZ-RBX changed the title Roblox's Migration Changes to DataStore2 v1.4.0 Roblox's Migration Module Changes to DataStore2 v1.4.0 Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant