エンジンクラス
GlobalDataStore
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
概要
方法
GetAsync(key: string,options: DataStoreGetOptions):Tuple |
IncrementAsync(key: string,delta: number,userIds: {any},options: DataStoreIncrementOptions):Variant |
OnUpdate(key: string,callback: function):RBXScriptConnection |
RemoveAsync(key: string):Tuple |
SetAsync(key: string,value: Variant,userIds: {any},options: DataStoreSetOptions):Variant |
UpdateAsync(key: string,transformFunction: function):Tuple |
BatchGetAsync(keys: {any},options: Dictionary):Dictionary |
APIリファレンス
方法
GetAsync
パラメータ
| 既定値: "nil" |
戻り値
IncrementAsync
GlobalDataStore:IncrementAsync(
):Variant
パラメータ
| 既定値: 1 |
| 既定値: "{}" |
| 既定値: "nil" |
戻り値
Variant
OnUpdate
SetAsync
GlobalDataStore:SetAsync(
):Variant
パラメータ
value:Variant |
| 既定値: "{}" |
| 既定値: "nil" |
戻り値
Variant
UpdateAsync
BatchGetAsync
パラメータ
| 既定値: "nil" |
戻り値
コードサンプル
Batch retrieve player scores
local DataStoreService = game:GetService("DataStoreService")
local playerScores = DataStoreService:GetOrderedDataStore("PlayerScores")
local keys = {"Player_123", "Player_456", "Player_789"}
local success, results = pcall(function()
return playerScores:BatchGetAsync(keys)
end)
if success then
for _, key in keys do
local entry = results[key]
if entry then
print(key .. " : " .. tostring(entry.value))
else
print(key .. " has no saved entry")
end
end
end