I am currently working on a mod request system and when I try to send it, it won't show up on discord even though HTTP Requests are Enabled.

Script 1:

--[[
	--// Filename: MainScript.lua
	--// Written By: MacFan2006
	--// Description: The main script of the Mod Request System.
	--// Stealing this code is for babies.
--]]

local FilteringFunction = game.ReplicatedStorage.FilteringFunction
local accused = script.Parent.AccusedUser.Value
local reason = script.Parent.ModJoinReason.Value
local description = script.Parent.Description.Value

local function SendModRequest()
	local request = FilteringFunction:InvokeServer(accused, reason, description)
end

script.Parent.Confirmation.ClickEater.Contents.PromptSendDontSend.SendDontSend.Yes.Activated:Connect(function()
	script.Parent.Confirmation.Visible = false
	script.Parent.SendingPleaseWait.Visible = true
	SendModRequest()
	wait(2)
	script.Parent.SentModRequest.Visible = true
	script.Parent.SendingPleaseWait.Visible = false
end)

Script 2:

--Setup
local webhook = "https://discord.osyr.is/api/webhooks/525516799819776023/qCtpF5eDuHxmf96jG0kv5Xic2p2Q4U7-pOonkPx_sXtjrvtH0t_V2BDZ1XN0KBdWh11F"

--Variables
local filteringFunction = game.ReplicatedStorage.FilteringFunction

--Services
local HTTP = game:GetService("HttpService")

function filteringFunction.OnServerInvoke(player, accused, reason, description)
	local payload = HTTP:JSONEncode({
		content = "Accused User:", accused, "Reason:", reason, "Description:", description,
		username = "Request sent by:" .. player.Name.." - (#"..player.UserId..")"
	})
	
	HTTP:PostAsync(webhook, payload)
	print("Request sent!")
end

Expected Output:

Request Sent!

6 comments

0

Alright, so just to check, on Script #2 is the link for the webhook actually ".osyr.is"? I have a similar script that works fine but uses .com . Secondly, discord takes messages, not necessarily tables of information that i'm aware of. Try making the "payload" be one string.

0

First, I tried one string and it still wouldn't work. Second, .com won't work.

0

oh, place the local "accused", local "reason", and local "description" inside the function and see if that fixes it. If you changed the values at some point, the script is only reading the values the game first loaded. Otherwise, is there any error in the output bar?

0

There is no error in the output and placing the variables in the function unfortunately didn't work. :( Sorry.

0

Can you try putting "print" functions into the different lines of code and seeing which ones are being played correctly? That'll help narrow down the issue

0

I put print functions in and I think I located the error! It's something to do with HTTP:PostAsync(webhook, payload)