21:10:15.207 - http 400 (bad request)

hi, i was working at an anti exploing script and i want when a player exploits to be kicked, but he every time is kicked but not how i want, i want to kick the player and send a message to discord to know that player exploited. The Script:


local ServerId = "I don't give it"
local HttpService = game:GetService("HttpService")

local function Hacker(plr,TypeOfHack)
	local message = 'the player named '..plr.Name..' exploited. The exploit he used: '..TypeOfHack..'. He was kicked. '..plr.Name.."'s Data: {Name: "..plr.Name..", UserId: "..plr.UserId..'}'
	local data = {
	name = 'Exploit bot';
	internalMessage = message;
	image = game.Players:GetUserThumbnailAsync(plr.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size180x180);
	}
	local Succes,Error = pcall(function()
	data = HttpService:JSONEncode(data)
	HttpService:PostAsync(ServerId,data,Enum.HttpContentType.ApplicationJson,true)
	end)
	if not Succes then
		warn(Error)
	end
	plr:Kick('Exploit: '..TypeOfHack)
end

but it always warns this:

21:10:15.207 - HTTP 400 (BAD REQUEST)

You aren’t providing a valid URL for HttpService:PostAsync(), What are you trying to do with the HTTPService request anyways?

to send to an discord but roblox don’t let me show my link

i think i don’t put the link good:

https://discordapp.com/api/webhooks/

should i change this part? The next numbers after the link i hide

Well you need to post to a discord hook and not the server id. Also that request is bad, here is the doccumentation for the JSON needed to post to a webhook. Also, the webhook link is fine. Just make sure you are doing HttpService:PostAsync(“https://discordapp.com/api/webhooks/”, data)

Here is the DISCORD webhook api : Discord Webhook - Discord Webhooks Guide (Sorry my bad wrong link)

i post at a discord hook 30characters

This is what your data table should look like.

local Content = 
	{
		["username"] = "Exploit bot",
		["content"] = message
	}
HttpService:PostAsync(WebHook, HttpService:JSONEncode(Content))

but i heard u can set and the image too

You can, just use
["avatar_url"] = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=150&Format=Png&username="..plr.Name