Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Datastore problem? API Services rejected request with error: Can't parse JSON?

This just happened today? I havent even touched my datastores? Team create is enabled so idk if that will do anything.

local DataStoreService = game:GetService("DataStoreService")
local Data = DataStoreService:GetDataStore("Data#92918937")

game.Players.PlayerAdded:connect(function(plr)
	local key = "id-"..plr.userId
	
	local data = Instance.new('Folder',plr)
	data.Name = "data"
	
	for i,v in pairs(game.Lighting.Stats.Data:GetChildren()) do
	v:clone().Parent = data
end

	local getSavedData = Data:GetAsync(key)
	
	if getSavedData then
		for i,v in pairs(data:GetChildren()) do
			v.Value = getSavedData[i]
		end
	else
		local saving = {}
		for i,v in pairs(data:GetChildren()) do
			table.insert(saving,v.Value)
		end	
		Data:SetAsync(key,saving)
	end
end)

game.Players.PlayerRemoving:connect(function(plr)
	local key = "id-"..plr.userId
	local data = plr:WaitForChild("data")
	
	local save = {}
	for i,v in pairs(data:GetChildren()) do
		table.insert(save,v.Value)
	end
	Data:SetAsync(key,save)
end)

13:50:28.989 - 502: API Services rejected request with error: Can't parse JSON 13:50:28.991 - Stack Begin 13:50:28.992 - Script 'ServerScriptService.DataStoreData', Line 14 13:50:28.994 - Stack End

Line 14 is local getSavedData = Data:GetAsync(key)

1 answer

✓ Accepted answer

ROBLOX is currently having some issues - wait a a half an hour or so and it will start working again.

This discussion is preserved as it was. New answers, comments, and votes are closed.