HttpService is not allowed to access ROBLOX resources

okay so im trying to make an enemy editor that can grab items from the roblox catalog using some cool APIs but it just doesnt want to work and gives me this error; “HttpService is not allowed to access ROBLOX resources”

SCRIPT

local event = game.ReplicatedStorage.Events.InsertModels
local marketplaceservice = game:GetService("MarketplaceService")

local insertservice = game:GetService("InsertService")
local assetservice = game:GetService("AssetService")

local Http = game:GetService("HttpService")

local AssetTypes = {
	["Hat"] = 9,
	["Shirt"] = 12,
	["Pants"] = 14
}

local url = "https://catalog.roblox.com/v2/search/items/details?Subcategory="..AssetTypes["Hat"].."&SortType=0&SortAggregation=5&Limit=30"

local pages = 25

local assets = {}


event.OnServerEvent:Connect(function(player,idx)
	print("created")
	for i = 1, pages do
		local response = Http:GetAsync(url)..tostring(i)
		local data = Http:JSONEncode(Http:GetAsync(url))
		data = Http:JSONDecode(data)

		for ii = 1, #data do
			local asset = data[ii]

			local id = asset.AssetId
			local name = asset.Name

			assets[#assets + 1] = "{Id = " ..id .. ", Name = \"" .. name .. "\"}"
			print(name)
		end
		print(i)
	end

	local source = "return { \n\t" .. table.concat(assets, ",\n\t") .. "\n}"
	print(source)
end)

Yeah you aren’t able to use Roblox API inside Roblox games so you’ll need to use a proxy to do that or find some other method.

3 Likes

can you tell me what is a proxy???

i actually saw something on the devforum saying this is some kind of “middle man” between the game and roblox but i dont know what they mean

Change this line:

local url = "https://catalog.roproxy.com/v2/search/items/details?Subcategory="..AssetTypes["Hat"].."&SortType=0&SortAggregation=5&Limit=30"

I’m not really sure the best way to explain this but I can try.

The Roblox server is trying to communicate to Roblox API servers which gets blocked, giving you that error.
If you use a proxy, the API request goes to the proxy which then passes that on to Roblox’s servers which don’t know that the request came from a Roblox game as they only see the proxy server and whatever the Roblox server gave, the proxy returns to your game via the request.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.