Discord Webhook | Don't Work

When I execute this script! Its the pcall function prints the error “HTTO 400 (Bad Request)”.
Can someone please help?
Thank you.

 local function send(player, text, serverId)
    	local HS = game:GetService("HttpService")
    	local WebhookLink = "https://discordapp.com/api/webhooks/........"
    	local tempdata = {
    		["content"] = "",
    		["embeds"] = {{
    			["title"] = ":bangbang: New Modcall :bangbang:",
    			["type"] = "rich",
    			["color"] = tonumber(0xf44336),
    			["fields"] = {
    				{
    					["name"] = "**Player**",
    					["value"] = string.format("%s | %s", player.Name, player.UserId) 	
    				},
    				{
    					["name"] = "**Reason**",
    					["value"] = text, 	
    				},
    				{
    					["name"] = "**Server ID**",
    					["value"] = serverId,
    				}
    			}

    		}}
    	}
    	
    	local jsonData = HS:JSONEncode(tempdata)
    	local Success, Failure = pcall(function()
    		HS:PostAsync(WebhookLink, jsonData)
    	end)
    	if not Success then
    		warn(Failure)
    	end
    end

    game.ReplicatedStorage.ModCall.sendEmbed.OnServerEvent:Connect(send)
1 Like

The code here should be working can I see the client script that is firing the remote?

There are a lot of similar topics to this, Maybe you could find an answer here.

I would suggest trying to make everything a string, except if its a bool.

1 Like

Sure:

script.Parent.modcall.TextButton.MouseButton1Click:Connect(function()
	local text = ""..script.Parent.modcall.TextBox.Text
	local serverId = nil
	if RS:IsStudio() then
		serverId = "N/A (Sent from Roblox Studio)"
	else
		serverId = tostring(game.JobId)
	end
	game.ReplicatedStorage.ModCall.sendEmbed:FireServer(Player, serverId, text)
end)

The Player argument is automatically included on the server, you don’t need to pass it in FireServer. Also your order of parameters is messed up, on the client you have serverId, text and on the server you have text, serverId

1 Like