In short
Data stores save to Roblox's servers, and Studio is not allowed to use them until you say so. Publish the place, then in Studio open File, Experience Settings, Security and switch on Enable Studio Access to API Services, then Save. The errors 403: Cannot write to DataStore from studio if API access is not enabled, Studio API access is not enabled and the older HTTP 403 (Forbidden) all mean this switch is off.
- With the switch on, Studio playtests read and write the real data of that experience. Roblox advises not to enable it on a live game: publish a separate test copy and enable it there.
- If the message is
You must publish this place to the web to access DataStore, the place has never been published: publish it first.
What the message means
ServerScriptService.SaveData:14: 403: Cannot write to DataStore from studio if API access is not enabled.
Other forms of the same message:
Studio API access is not enabled. Enable it by going to the Experience Settings page.You must publish this place to the web to access DataStore.502: API Services rejected request with error. HTTP 403 (Forbidden)
Roblox lists this as data store error code 403, StudioAccessToApisNotAllowed. It only happens in Studio; live servers are always allowed to use data stores.
Wrap every data store call in pcall. Even with access on, calls can fail (throttling, outages), and an unwrapped failure stops the script and can lose a player's save.
Causes and fixes
Two things cause this error in practice. Each one below has the smallest code that triggers it, then the fix.
Studio access to API services is off
The default for every experience. The first GetAsync or SetAsync in a Studio playtest fails.
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local store = DataStoreService:GetDataStore("PlayerCoins")
Players.PlayerAdded:Connect(function(player)
-- in Studio with access off: 403 ... API access is not enabled
local coins = store:GetAsync(tostring(player.UserId))
print(coins)
end)
Switch on Enable Studio Access to API Services (File, Experience Settings, Security) and Save. In code, call data stores inside pcall so a failure is reported instead of stopping the script.
local DataStoreService = game:GetService("DataStoreService")
local Players = game:GetService("Players")
local store = DataStoreService:GetDataStore("PlayerCoins")
Players.PlayerAdded:Connect(function(player: Player)
local ok, result = pcall(function()
return store:GetAsync(tostring(player.UserId))
end)
if not ok then
warn(`[SaveData] could not load {player.Name}: {result}`)
return
end
local coins = if typeof(result) == "number" then result else 0
print(player.Name, "has", coins)
end)
The place was never published
A data store belongs to a published experience. A local file has no experience behind it, so Studio says You must publish this place to the web to access DataStore.
local DataStoreService = game:GetService("DataStoreService")
-- an unpublished place: You must publish this place to the web to access DataStore.
local store = DataStoreService:GetDataStore("Settings")
store:SetAsync("MaxPlayers", 10)
Publish with File, Publish to Roblox, then turn on Studio access. Until then, have the script skip saving cleanly instead of erroring.
local DataStoreService = game:GetService("DataStoreService")
local store = DataStoreService:GetDataStore("Settings")
local ok, err = pcall(function()
store:SetAsync("MaxPlayers", 10)
end)
if not ok then
warn("[Settings] not saved (publish the place and enable Studio access):", err)
end
Fix it in your place
Paste the error, RoCode fixes it in your place
Copy the line from Output and paste it here. RoCode opens the script it names in the place you have open in Studio, works out which of the causes above it is, and edits the code there instead of handing you a snippet to paste.
RoCode is an AI agent for Roblox Studio: it reads the scripts in the place you have open, finds the line and edits it there, and every change is an undo point. It runs on Windows or macOS with a desktop browser. Free to start, with free credits every day.
How to find the line that causes it
- Click the red line in Output to open the script at the data store call that failed.
- If the message mentions API access, the code is fine: the fix is the Experience Settings switch, not the script.
- Search for
GetDataStorewith Ctrl+Shift+F to find every data store call, and check each one is insidepcall.
Questions
Where is Enable Studio Access to API Services?
In Roblox Studio: File, Experience Settings (Game Settings in older versions), Security. Switch it on and Save. The place must be published first.
Does it affect my live game?
No. Live servers can always use data stores. The switch only lets Studio playtests read and write them, and those are the same stores your players use. Roblox advises enabling it on a separate test copy of the experience, not on the live one.
Why does it work in the live game but not in Studio?
Because Studio access is off. Live servers do not need the switch.
Can RoCode fix it?
RoCode can fix the code: it wraps every data store call in pcall and handles failures. The Studio access switch is an Experience Settings change you make yourself.
Sources and further reading
- Roblox Creator Docs: data store error codes and limits. 403 StudioAccessToApisNotAllowed
- Roblox Creator Docs: data stores. File, Experience Settings, Security, Enable Studio Access to API Services, and the advice to use a test copy
How the code was checked: every block marked Fixed passes Luau's strict type checker against Roblox's API definitions (luau-lsp, 23 October 2026), and every block marked Breaks compiles and fails only when it runs. The message wording was checked against the message strings in Roblox Studio itself (macOS build of 13 October 2026) and the data store error code list on 23 October 2026. The HTTP 403 (Forbidden) form is how many DevForum posts quote the older wording. A type check catches misspelt APIs and wrong types, not game logic, so playtest in Studio before you publish.