Sending in a webhook to discord with no errors and debug messages in sight

  1. What do you want to achieve?
    I’d like the send to a webhook for everytime a player is kicked, banned or unbanned.

  2. What is the issue?
    The script is not sending the webhooks, no debug messages either. None of that

warn("Failed to send message to Discord webhook. Response:", response)

or

print("Message sent to Discord webhook successfully.")
  1. What solutions have you tried so far?
    Everything I know. The ban, kick, and unban works while the sendWebhook function doesn’t to work.
local authorizedPlayers = {}
local HttpService = game:GetService("HttpService")
local webhookURL = "https://discord.com/api/webhooks/1089446375256752159/----"

local function sendWebhook(title, description, url, admin, timestamp)
	local success, response = pcall(function()
		return HttpService:PostAsync(webhookURL, HttpService:JSONEncode({
			embeds = {{
				title = title,
				description = description,
				url = url,
				fields = {{
					name = "Admin",
					value = admin.Name,
					inline = false
				}, {
					name = "Timestamp",
					value = timestamp,
					inline = false
				}}
			}}
		}), Enum.HttpContentType.ApplicationJson)
	end)

	if not success then
		warn("Failed to send message to Discord webhook. Response:", response)
	else
		print("Message sent to Discord webhook successfully.")
	end
end

local function banPlayer(admin, player, reason, sendMessage)
	if sendMessage then
		local banDate = os.date("%c")
		sendWebhook(player.Name .. " has been banned", "Reason: " .. reason, "https://www.roblox.com/users/" .. player.UserId .. "/profile", admin, banDate)
	end
end

local function unbanPlayer(admin, playerId)
	sendWebhook("Player with ID " .. playerId .. " has been unbanned", "", "https://www.roblox.com/users/" .. playerId .. "/profile", admin, os.date("%c"))
end

local function kickPlayer(admin, player, reason)
	sendWebhook(player.Name .. " has been kicked", "Reason: " .. reason, "https://www.roblox.com/users/" .. player.UserId .. "/profile", admin, os.date("%c"))
end

I’ve hidden the rest of the code

I believe you came across an issue that I was dealing with long time ago.
You will have to use proxy for sending discord webhooks & I recommend using this :smiley:

Yes, Discord blocked Roblox from using their Webhooks due to spam. Use a proxy as @CodeSaviour suggested.