Apprendre
Classe de moteur
GlobalDataStore
Création impossible
Non répliqué

*Ce contenu est traduit en utilisant l'IA (Beta) et peut contenir des erreurs. Pour consulter cette page en anglais, clique ici.


Résumé
Méthodes
IncrementAsync(key: string,delta: number,userIds: {any},options: DataStoreIncrementOptions):Variant
OnUpdate(key: string,callback: function):RBXScriptConnection
Déprécié
SetAsync(key: string,value: Variant,userIds: {any},options: DataStoreSetOptions):Variant
UpdateAsync(key: string,transformFunction: function):Tuple
Membres hérités

Référence API
Méthodes
GetAsync
Rendement
Capacités : DataStore
GlobalDataStore:GetAsync(
Paramètres
key:string
Valeur par défaut : "nil"
Retours

IncrementAsync
Rendement
Capacités : DataStore
GlobalDataStore:IncrementAsync(
key:string, delta:number, userIds:{any}, options:DataStoreIncrementOptions
):Variant
Paramètres
key:string
delta:number
Valeur par défaut : 1
userIds:{any}
Valeur par défaut : "{}"
Valeur par défaut : "nil"
Retours
Variant

OnUpdate
Déprécié

RemoveAsync
Rendement
Capacités : DataStore
GlobalDataStore:RemoveAsync(key:string):Tuple
Paramètres
key:string
Retours

SetAsync
Rendement
Capacités : DataStore
GlobalDataStore:SetAsync(
key:string, value:Variant, userIds:{any}, options:DataStoreSetOptions
):Variant
Paramètres
key:string
value:Variant
userIds:{any}
Valeur par défaut : "{}"
Valeur par défaut : "nil"
Retours
Variant

UpdateAsync
Rendement
Capacités : DataStore
GlobalDataStore:UpdateAsync(
key:string, transformFunction:function
Paramètres
key:string
transformFunction:function
Retours

BatchGetAsync
Rendement
Capacités : DataStore
GlobalDataStore:BatchGetAsync(
keys:{any}, options:Dictionary
Paramètres
keys:{any}
options:Dictionary
Valeur par défaut : "nil"
Retours
Échantillons de code
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

©2026 Société Roblox. Roblox, le logo Roblox et Powering Imagination font partie de nos marques déposées aux États-Unis et dans d'autres pays.