Stellar AI

Errors

Roblox 'StudioAccessToApisNotAllowed' DataStore Error – Fix

The error

DataStoreService: StudioAccessToApisNotAllowed: Studio access to APIs is not allowed. API: GetAsync, Data Store: PlayerData
DataStoreService: StudioAccessToApisNotAllowed: Cannot write to DataStore from studio if API access is not enabled. API: SetAsync, Data Store: PlayerData

Your DataStore code is being blocked before it reaches Roblox, so nothing loads or saves while you test in Studio. In live servers the same code can work fine. Work through these causes in order.

1. Studio access to API services is off

Open Game Settings > Security (File > Game Settings, called Experience Settings in newer Studio versions), turn on Enable Studio Access to API Services, and save. Then stop and start the playtest again.

2. The place is not published

DataStores belong to an experience, so a local file that has never been published has nowhere to store data and the setting cannot be turned on. Publish it with File > Publish to Roblox first, then enable the setting.

3. You are testing against live player data

Once Studio access is on, Studio reads and writes the same DataStores as your live game. A broken save script in a test session can overwrite real players' data. Test in a separate copy of the experience, or use a different DataStore name while in Studio, as in the snippet below.

4. Errors are not caught

DataStore calls can fail for other reasons too (throttling, outages). Wrap every call in pcall so one failure does not stop the rest of your script, and print the error so you know which one you hit.

Debug snippet

-- Script in ServerScriptService
local DataStoreService = game:GetService("DataStoreService")
local RunService = game:GetService("RunService")

-- use a separate store name in Studio so tests never touch live data
local storeName = RunService:IsStudio() and "PlayerData_Studio" or "PlayerData"
local store = DataStoreService:GetDataStore(storeName)

local ok, result = pcall(function()
    return store:GetAsync("test_key")
end)

if ok then
    print("DataStore OK:", storeName, result)
else
    warn("DataStore failed:", result)
    if string.find(tostring(result), "StudioAccessToApisNotAllowed") then
        warn("Enable Studio Access to API Services in Game Settings > Security, then restart the test")
    end
end

If you still see the error after enabling the setting, check you published and saved the settings for the same experience you have open in Studio.

Real reports of this error: DevForum: StudioAccessToApisNotAllowed on GetAsync and DevForum: the same error on SetAsync.

Related errors

Related tools: Roblox script generator · Roblox Lua error fixer · all script generators