HTTP 400 (Bad Request)

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i want a function where you buy robux and put your asset on the leaderboard so people can buy it
  2. What is the issue? Include screenshots / videos if possible!
    i am getting this error for no reason
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i tried many forums but they just dont work
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local Market = game:GetService("MarketplaceService")
local HTTPService = game:GetService("HttpService")

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local EventsFolder = ReplicatedStorage:FindFirstChild("ProductEvents")

game.Players.PlayerAdded:Connect(function(plr)
	local PF = Instance.new("Folder", plr)
	PF.Name = "ProductFolder"
	local HttpService = game:GetService("HttpService")

	local CanSeeInventory = "https://inventory.roproxy.com/v1/users/"..plr.UserId.."/can-view-inventory"
	local Response = HttpService:RequestAsync({
		Url = CanSeeInventory,
		Method = "GET"
	});
	if Response.Success then -- If it doesnst work, then idk	
		local Body = HttpService:JSONDecode(Response.Body) -- Decoding the table
		if Body.canView == true then

			local function CloneAssets(Gui, Contents, Template)
				print("St. -1")
				for _, player in pairs(game:GetService("Players"):GetPlayers()) do
					for _, Asset in pairs(Contents) do
						print("St. 0")
						local data = Market:GetProductInfo(Asset, Enum.InfoType.Asset)
						print("Statment 1 passed")
						if data and data.IsForSale then
							local Gui = Template:Clone()
							Gui.Parent = Gui
							Gui.Name = table.find(Contents, Asset)
							Gui.PurchaseButton.Text = data.PriceInRobux .. "$"
							Gui.Visible = true
							Gui.ImportantValues:FindFirstChild("AssetId").Value = Asset
							print("St. 2")
						end
					end
				end
				for _, Asset in ipairs(Contents) do
					local data = Market:GetProductInfo(Asset, Enum.InfoType.Asset)
					if data and data.IsForSale then
						local MainGui = Gui
						MainGui.Name = table.find(Contents, Asset)
						MainGui.PurchaseButton.Text = data.PriceInRobux .. "$"
						MainGui.Visible = true
						MainGui.ImportantValues:FindFirstChild("AssetId").Value = Asset
						print("St. 3")
					end
				end
			end


			local SubCategories = {
				"2";
				"11";
				"12"
			}

			local function GetContent(username, userid, tshirts, cursor)
				
				for i = 1,3 do
					local Contents = {}
					 cursor = cursor or ""

					local Url = "https://catalog.roproxy.com/v1/search/items/details?Category=3&Subcategory=".. SubCategories[i].. "&Sort=4&Limit=30&CreatorName=%s&cursor=%s"
					local requestUrl = Url:format(username, cursor)
					local success, result = pcall(function()
						return HTTPService:GetAsync(requestUrl, true)
					end)

					if success then
						if result then
							local success2, result2 = pcall(function()
								return HTTPService:JSONDecode(result)
							end)
							local suc, er = pcall(function()
								for _, tshirt in ipairs(result2.data) do
									table.insert(Contents, tshirt.id)
								end
							end)
							if not suc then
								warn(er)
							end
							return Contents
						end
					else
						print(result)
					end
				end
			end



			EventsFolder:WaitForChild("SetAsset").OnServerEvent:Connect(function(plr, username, userid)
				local Boothname, Contents = GetContent(username, userid)
				print(Contents)
				if Contents then
					CloneAssets(plr.PlayerGui.LiveDonationScreen.Main.ProductFrame, Contents, plr.PlayerGui.LiveDonationScreen.Main.ProductFrame.Layout)
				end
			end)
			
		else
			game.ReplicatedStorage:WaitForChild("ProductEvents"):WaitForChild("WarnPlayer"):FireClient(plr)
		end
	end
end)

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

the result is the error, why? idk.

so the error is on this part .

is “Allow HTTP Requests” enabled in game settings? (just to make sure)

Subcategories are not available for this requeust.

Perhaps you should check the RoProxy documentation and make sure your request matches what the request should look like. An HTTP 400 error means that RoProxy (the server) didn’t understand your request perhaps the syntax is wrong.

You are sending invalid subcategories.

Replace your subcategories with:
55 - TShirt
56 - Shirt
57 - Pants

Use this to convert AssetTypes to subcategories:
https://catalog.roblox.com/v1/asset-to-subcategory

ok guys im back and i will check some replies and send feedback or whatever

Yes its on thanks for telling me.

ok thanks for the info.

ok i might check the documentation, thanks for the info

thanks for the help i will try it.

1 Like