Loading...
Loading...
Compare original and translation side by side
DataStoreServiceSetAsync()UpdateAsync()IncrementAsync()MemoryStoreServiceMessagingServiceDataStoreServiceSetAsync()UpdateAsync()IncrementAsync()MemoryStoreServiceMessagingServiceUpdateAsync()MessagingServiceroblox-networkingroblox-coreroblox-apiUpdateAsync()nilGetAsync()pcall()UpdateAsync()MessagingServiceroblox-networkingroblox-coreroblox-apireferences/data-stores-guides.mdreferences/data-store-best-practices.mdreferences/versioning-listing-caching-limits-and-observability.mdreferences/memory-stores-guides.mdreferences/memory-store-best-practices-limits-and-observability.mdreferences/cross-server-messaging.mdreferences/data-stores-vs-memory-stores-comparison.mdUpdateAsync()nilGetAsync()pcall()UpdateAsync()pcall()references/data-stores-guides.mdreferences/data-store-best-practices.mdreferences/versioning-listing-caching-limits-and-observability.mdreferences/memory-stores-guides.mdreferences/memory-store-best-practices-limits-and-observability.mdreferences/cross-server-messaging.mdreferences/data-stores-vs-memory-stores-comparison.mdSetAsync()GetAsync()MessagingServiceUpdateAsync()pcall()SetAsync()GetAsync()MessagingServiceUpdateAsync()local DataStoreService = game:GetService("DataStoreService")
local profileStore = DataStoreService:GetDataStore("PlayerProfiles")
local function saveCoins(userId, delta)
return profileStore:UpdateAsync(("player/%d"):format(userId), function(current, keyInfo)
current = current or {schemaVersion = 1, coins = 0}
current.coins += delta
return current, keyInfo:GetUserIds(), keyInfo:GetMetadata()
end)
endUpdateAsync()-- Publish: "queue has work"
-- Receiver: read the queue or map, then process authoritative state there.local DataStoreService = game:GetService("DataStoreService")
local profileStore = DataStoreService:GetDataStore("PlayerProfiles")
local function saveCoins(userId, delta)
return profileStore:UpdateAsync(("player/%d"):format(userId), function(current, keyInfo)
current = current or {schemaVersion = 1, coins = 0}
current.coins += delta
return current, keyInfo:GetUserIds(), keyInfo:GetMetadata()
end)
end-- Publish: "queue has work"
-- Receiver: read the queue or map, then process authoritative state there.