Học
Lớp công cụ
GlobalDataStore
Không Thể Tạo
Không Sao Chép

*Nội dung này được dịch bằng AI (Beta) và có thể có lỗi. Để xem trang này bằng tiếng Anh, hãy nhấp vào đây.


Tóm Tắt
Phương Pháp
IncrementAsync(key: string,delta: number,userIds: {any},options: DataStoreIncrementOptions):Variant
OnUpdate(key: string,callback: function):RBXScriptConnection
Đã Lỗi Thời
SetAsync(key: string,value: Variant,userIds: {any},options: DataStoreSetOptions):Variant
UpdateAsync(key: string,transformFunction: function):Tuple
Thành viên kế thừa
Được kế thừa bởi

Tài Liệu Tham Khảo API
Phương Pháp
BatchGetAsync
Sinh Lợi
Các khả năng: DataStore
GlobalDataStore:BatchGetAsync(
keys:{any}, options:Dictionary
Tham Số
keys:{any}
options:Dictionary
Giá Trị Mặc Định: "nil"
Lợi Nhuận
Mẫu mã
Lấy điểm của người chơi theo lô
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 .. " không có mục đã lưu")
end
end
end

GetAsync
Sinh Lợi
Các khả năng: DataStore
GlobalDataStore:GetAsync(
Tham Số
key:string
Giá Trị Mặc Định: "nil"
Lợi Nhuận

IncrementAsync
Sinh Lợi
Các khả năng: DataStore
GlobalDataStore:IncrementAsync(
key:string, delta:number, userIds:{any}, options:DataStoreIncrementOptions
):Variant
Tham Số
key:string
delta:number
Giá Trị Mặc Định: 1
userIds:{any}
Giá Trị Mặc Định: "{}"
Giá Trị Mặc Định: "nil"
Lợi Nhuận
Variant

OnUpdate
Đã Lỗi Thời

RemoveAsync
Sinh Lợi
Các khả năng: DataStore
GlobalDataStore:RemoveAsync(key:string):Tuple
Tham Số
key:string
Lợi Nhuận

SetAsync
Sinh Lợi
Các khả năng: DataStore
GlobalDataStore:SetAsync(
key:string, value:Variant, userIds:{any}, options:DataStoreSetOptions
):Variant
Tham Số
key:string
value:Variant
userIds:{any}
Giá Trị Mặc Định: "{}"
Giá Trị Mặc Định: "nil"
Lợi Nhuận
Variant

UpdateAsync
Sinh Lợi
Các khả năng: DataStore
GlobalDataStore:UpdateAsync(
key:string, transformFunction:function
Tham Số
key:string
transformFunction:function
Lợi Nhuận

©2026 Roblox Corporation. Roblox, logo Roblox và Powering Imagination là các nhãn hiệu đã đăng ký và chưa đăng ký của chúng tôi tại Hoa Kỳ và các quốc gia khác.