502: API Services rejected request with error. Error code: 0 Reason: Access forbidden

My roblox game has been experiencing ALOT of data issues so i tried configuring it and it just kept saying “502: API Services rejected request with error. Error code: 0 Reason: Access forbidden.” whenever i tried saving

Heres the saving script


local function saveData(plr)
	local key = "plr-"..plr.userId
	print("Saving to", key)
	local datatosave = {
		plr.Stats.Rebirths.Value,
		plr.Stats.Ultra.Value,
		plr.leaderstats.Rarity.Value,
		plr.leaderstats.Rerolls.Value,
		plr.Stats.TimePlayed.Value,
		plr.Stats.RarityNum.Value,
		plr.Stats.RollSpeed.Value,
		plr.Stats.RollBulk.Value,
		plr.Stats.HighestRarityNum.Value,
		plr.Stats.HighestRarity.Value,
		plr.Stats.RuneSpeed.Value,
		plr.Stats.Prestige.Value,
		plr.Stats.Super.Value,
		plr.Stats.Tokens.Value,
		plr.Stats.RuneBulk.Value,
		plr.Stats.Essence.Value,
		plr.Stats.Energy.Value,
		plr.Stats.DarkEnergy.Value,
		plr.Stats.EnergyGain.Value,
		plr.Stats.DarkGain.Value,
		plr.Stats.EnergyTime.Value,
		plr.Stats.Pumpkins.Value,
		plr.Stats.GhostPumpkins.Value,
		plr.Stats.Spirits.Value,
		plr.Stats.Crystals.Value,
		plr.Stats.HalloweenToken.Value,
		plr.Stats.Gems.Value,
	}

	local success, err = pcall(function()
		Data:SetAsync(key,datatosave)	
	end)

	if success then
		print("Data has been saved to", key)
	else
		print("Data has failed to save.")
		warn(err)	
	end
end
1 Like

Make sure you actually have the right permissions for the place you’re trying to publish to. The error message is very literal: you don’t have access to the cloud services of the target place.

You probably don’t have Studio API Services on in the Game Settings
Also use pcall(Data.SetAsync, Data, key, datatosave) over that (also should probably jsonencode it to prevent future weirdness)

I have studio api services enabled.
The error started happening after a game update
before that it was fine then it just started returning alot of errors and people started losing data