Syntax
local store = game:GetService("DataStoreService"):GetDataStore("LessonProgress_TEST_v1")Examples
Choose an explicit test namespace
Script in ServerScriptService of a separate published test experience. Enable Studio API access only for that test experience. This obtains a store handle; it does not read or write data yet.
local DataStoreService = game:GetService("DataStoreService")
local store = DataStoreService:GetDataStore("LessonProgress_TEST_v1")
local function playerKey(userId: number): string
return "player:" .. tostring(userId)
end
print("Test key:", playerKey(12345))Inspect a request budget
Separate server Script in the test experience. A budget value is a point-in-time hint, not a reservation or a promise that the next request succeeds. All requests still need protected calls and a failure path.
local DataStoreService = game:GetService("DataStoreService")
local budget = DataStoreService:GetRequestBudgetForRequestType(Enum.DataStoreRequestType.GetAsync)
print("Current read budget:", budget)
if budget < 1 then
warn("Defer non-essential reads instead of starting a burst")
endBest practices
- Do not test against production player keys; a different key alone is weaker isolation than a separate experience.
- Use stable UserId-based keys rather than names.
- Plan for throttling, unavailable services, schema changes and failed saves before relying on persistence.
Runtime & versions
Luau host; Roblox engine examples require Roblox Studio. Feature availability depends on the language and runtime version used by your project; consult the official reference below.
Luau documentation