Lớp công cụ
GlobalDataStore
*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
BatchGetAsync(keys: {any},options: Dictionary):Dictionary |
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 |
Được kế thừa bởi
Tài Liệu Tham Khảo API
Phương Pháp
BatchGetAsync
Tham Số
| 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
endGetAsync
Tham Số
| Giá Trị Mặc Định: "nil" |
Lợi Nhuận
IncrementAsync
GlobalDataStore:IncrementAsync(
):Variant
Tham Số
| Giá Trị Mặc Định: 1 |
| Giá Trị Mặc Định: "{}" |
| Giá Trị Mặc Định: "nil" |
Lợi Nhuận
Variant
OnUpdate
SetAsync
GlobalDataStore:SetAsync(
):Variant
Tham Số
value:Variant |
| Giá Trị Mặc Định: "{}" |
| Giá Trị Mặc Định: "nil" |
Lợi Nhuận
Variant