HTTP 400(Bad Request)

Im trying to make the webhook send a message when the event is fired.
Code :

game.Lighting.ExploitBot.Event:connect(function(plr,cause)
	game.SoundService.CaughtNoob:Play()
	print(plr.Name.." noob exploiter")
	
	local HttpServ = game:GetService('HttpService')
	local url = "https://discord.com/api/webhooks/xxxxxxx"
	local data = 
		
		{
			["content"] = "",
			["embeds"] = {{
				["title"] = "someone was banned lol",
				["description"] = "lool",
				["type"] = "rich",
				["color"] = tonumber(0xffffff),
				["fields"] = {
					{
						["name"] = "Player",
						["value"] = plr,
						["inline"] = true
					},
					{
						["name"] = "__Title__",
						["value"] = cause,
						["inline"] = true
					}
				}
			}}
		}
	
	local newdata = HttpServ:JSONEncode(data)

	HttpServ:PostAsync(url, newdata)

	
game.Lighting.SystemMessage:FireAllClients(plr.Name.." just got busted by the gorilla lord.... lol. You won't see them anytime soon ; )",Enum.Font.Arcade,Color3.new(1,0.5,0.5),true)
     local baninfo = {cause,GetDate(),"Exploiting","System"}
     if plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
		table.insert(baninfo,tostring(plr.Character.HumanoidRootPart.CFrame.p))
	 else 
		table.insert(baninfo,"-")
     end
     if plr.Character and plr.Character:FindFirstChild("_battle") then
		table.insert(baninfo,plr.Character["_battle"].Value.Name)
	else
		table.insert(baninfo,"-")
	end 
     game.Lighting.Assets.Despacito2:Clone().Parent = plr.PlayerGui
     if plr.UserId ~= 76355774 and plr.UserId ~= 81898264 then
	    game:GetService("DataStoreService"):GetDataStore("UTMonsterMania"..plr.UserId):SetAsync("BanInfo",baninfo)
    end
    delay(10,function() if plr then plr:Kick("You have been banned for: "..baninfo[3]) end end)
end)
game.Lighting.InfinityGauntlet.OnServerEvent:Connect(function(plr,reason)
	print("B A N")
	if typeof(reason) == "string" then
		print(reason)
		game.Lighting.ExploitBot:Fire(plr,reason)
	else
		print("lol noob exploiter")
		game.Lighting.ExploitBot:Fire(plr,"Attempt to ban themselves (nice)")
	end
end)function GetDate(s)
	print("timedato")
	local get = os.date("*t",os.time())
	local date = ""
1 Like

Probably a duplicate question: HTTP 400 (Bad Request) error? - #7 by Webm07

1 Like

Have you turned access to Roblox API’s and HTTP Requests on?

HTTP errors are given by the specific endpoint where the request is sent, so it depends entirely on that endpoint.

In general, an HTTP 400 error means your request was not formatted correctly. Make sure to check the documentation of the api you’re interacting with and see if everything is formatted correctly.

The docs for Discord’s webhooks are here.

@GamersInternational
Turning off http requests won’t give any http error since no http requests are ever made.

The error given by turning http requests off is: Http requests are not enabled. Enable via game settings

Change ["embeds"] to ["embed"].

The object you send uses a field called “embeds”, not “embed”. OP has that part right.