:RegisterKey

Pre-registers a data key and its options on the server, essentially "whitelisting" it as a valid key before any data is created for it.

This is a crucial utility for preventing race conditions and enhancing security. It's highly recommended to register all your data keys when the server starts. Client requests for keys that have not been registered are considered suspicious and will be penalized by the intelligent rate limiting system.

When to Use :RegisterKey vs. :Create?

  • Use :RegisterKey() when your server starts to define all possible data keys your game will use. This is perfect for keys where data might be loaded asynchronously (e.g., from a DataStore) and won't be available immediately.

  • Use :Create() when you are ready to set the initial data for a key. If the key wasn't previously registered, :Create() will also register it for you.


DataReplicator:RegisterKey(realKey: string, options: table?)


  • realKey: string

    The unique, case-sensitive key for the data. It's a good practice to use a consistent naming convention (e.g., "PlayerData_12345").

  • options: table?

    An optional dictionary to configure advanced features for this data key. These settings are locked in the first time the key is registered or created.

    • Encrypted: boolean - (Default: false) If true, all data for this key will be protected by transport encryption. A unique session key is securely established for each player using a post-quantum key exchange. Best for sensitive information like currency or private settings.

    • Priority: string - (Default: "Medium") Sets the update priority. Can be "High", "Medium", or "Low".

    • UseDeltaCompression: boolean - (Default: false) If true, only changes within a table will be replicated after the initial full sync.

Last updated