DataStoreSetOptions

DataStoreSetOptions : Instance

Overview

Properties

Methods

GetMetadata

The GetMetadata() method retrieves metadata that has been set using the SetMetadata() function. This can be useful for debugging or analyzing stored data.

Parameters

Return

Dictionary

Code Samples

local options = Instance.new("DataStoreSetOptions")
options:SetMetadata(
{
    Reason = "DailyMission"
})
			
print(options:GetMetadata())

SetMetadata

The SetMetadata() method allows developers to define custom metadata for a key.

Parameters

Dictionary InMetaDataTable

Return

void

Code Samples

local DataStoreService = game:GetService("DataStoreService") 
local GoldStore = DataStoreService:GetDataStore("PlayerGold") 

local success, errorMessageOrLoadValue = pcall(function()
    local userIds = nil
    local options = Instance.new("DataStoreSetOptions")
    options:SetMetadata(
    {
        Reason = "DailyMission"
    })
			
    GoldStore:SetAsync(player.UserId, 100, userIds, options) 
end)

Events

Last updated