I am trying to make a discord webhook when a player dies

I am trying to make a discord webhook when a player dies, but it gave me this error:
HTTP 500 (Internal Server Error)

Here is the script[I have remove some variables like the link]:

local httpService = game:GetService("HttpService")

local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage.emsRemoteEvents.playerSurvival

local function sendWebhook(player)
	httpService:PostAsync(webHook,
		httpService:JSONEncode({
			content = "**"..player.Name .."**".." has died."
		}),
		Enum.HttpContentType.ApplicationJson
	)
end

event.OnServerEvent:Connect(function(player)
	local statusFolder = player:FindFirstChild("StatusFolder")
	local Downed = statusFolder:FindFirstChild("Downed")
	local Shot = statusFolder:FindFirstChild("Shot")

	Shot.Value = false
	Downed.Value = false

	local success, response = pcall(function()
		sendWebhook(player)
	end)
end)
2 Likes

I have also used this too:

https://webhook.lewisakura.moe/api/webhooks/
1 Like