Mod call system not working

Hey guys, so I am making a mod call system that works through discord webhooks, even tho i made the webhook and stuff, i still can’t manage for it to work.

local HttpService = game:GetService("HttpService")
local WebhookURL = "https://discord.com/api/webhooks/1184447576796299274/hPHIuqhOgNHHotDHYmVcnBxGRmjN8BQArb8qUf779PvTKp6eFIz0-R-S-hB7U8zy-ZA9" 

local function postToDiscord(Message)
	local Data = {
		["content"] = Message
	}
	Data = HttpService:JSONEncode(Data)
	HttpService:PostAsync(WebhookURL, Data)
end

game.ReplicatedStorage.Report.OnServerEvent:Connect(function(player,reason)
	postToDiscord("**"..player.Name.."** has requested for a moderator to come for the reason of: **"..reason.."** ||@here||")
end)


Basically I get error 403 forbidden at line 9.

In the Games Settings > Security > enable HTTP Requests

1 Like

Http requests are already enabled.
image

I looked abit in the HttpService Document on Roblox, probably just copy this below

HttpService:PostAsync(WebhookURL, Data, Enum.HttpContentType.ApplicationUrlEncoded, false)

Else make a pcall() the function might not work properlly

local success = nil
local errorMsg = nil
local attempt = 1

repeat
	success, errorMsg = pcall(function()
		HttpService:PostAsync(WebhookURL, Data, Enum.HttpContentType.ApplicationUrlEncoded, false)
	end)
	
	attempt += 1
	if not success then
		task.wait(1)
		warn(errorMsg)
	end
until success or attempt == 5

Discord is blocking Roblox from posting webhooks and you would have to use a third party service for this now, this reply explains more Discord webhook not working in the real game - #2 by DARKMASTER6906

even tho using third party services doesn’t fix the issue. imma just pretend it actually mod calls

This proxy will help you.

I also suggest fixing your code to this

local HttpService = game:GetService("HttpService")

local WebhookURL = "https://discord.com/api/webhooks/1184447576796299274/hPHIuqhOgNHHotDHYmVcnBxGRmjN8BQArb8qUf779PvTKp6eFIz0-R-S-hB7U8zy-ZA9"

local function postToDiscord(Message)
    local Data = {
        ["content"] = Message
    }
    
    local Headers = {
        ["Content-Type"] = "application/json"
    }

    local RequestData = {
        Url = WebhookURL,
        Method = "POST",
        Headers = Headers,
        Body = HttpService:JSONEncode(Data)
    }

    HttpService:PostAsync(RequestData)
end

game.ReplicatedStorage.Report.OnServerEvent:Connect(function(player, reason)
    postToDiscord("**" .. player.Name .. "** has requested for a moderator to come for the reason of: **" .. reason .. "** ||@here||")
end)

Also don’t forget to change your webhook now that it’s public.

the potential issue with the use of the HttpService:PostAsync method. The PostAsync method typically requires additional parameters, such as the content type and headers. You should ensure that your request is properly formatted by providing the necessary headers and specifying the content type as JSON.

One, get another discord webhook, someone can do something dangerous with that information, and Two use a 3rd party webhook rerouter/proxy, discord blocked roblox servers from sending anything through their HTTP(S) servers.

Try out or test random servers until you do get it, but also when you do, delete the current one just in case it gets compromised.

2 Likes

Look at my post Mod call system not working - #7 by Vvshenok
I already sent him a working proxy https://webhook.lewisakura.moe/

He should also delete the current webhook first, as it can be used dangerously by someone anonymously, if they do have that type of point.

I already deleted the webhook and made a different type of mod call system.

my tip: don’t implement a “mod call system” in the first place. its unefficent and trolls will just misuse it.

Did you try using my script? I would like feedback if doesn’t work just let me know.

He should make a abuse system with it as well, and use filiterservice so players don’t swear etc…