Discord Integration Not Working

This script is pretty basic, but the input from the textbox isn’t being sent to the discord for some reason. No errors, just not working. If anyone has any advice I would be very appreciative :slight_smile:

Server Script:

local http = game:GetService("HttpService")
local cooldown = false
local rem1 = game.ReplicatedStorage:WaitForChild("Server")
local rem2 = game.ReplicatedStorage:WaitForChild("Client")

script.Parent.Parent.Parent.SendGui.TextButton.MouseButton1Click:Connect(function(plr)
	rem1:FireAllClients()
	rem2.OnServerEvent:Connect(function(player, input)
		local Data = {
			["content"] = input
		}
		Data = http:JSONEncode(Data)
		http:PostAsync("editing out my integration link but pretend its here", Data)
		cooldown = true
		wait(60)
		cooldown = false
	end)
end)

Local Script (Inside ReplicatedStorage):

local rem = game.ReplicatedStorage:WaitForChild("Server")
local rem2 = game.ReplicatedStorage:WaitForChild("Client")
local input = game.Workspace:WaitForChild("Part").SurfaceGui.TextBox.Text

rem.OnClientEvent:Connect(function()
	rem2:FireServer(input)
end)

discord blocked api requests a while ago you could try some proxies such as this

That didn’t fix it. What’s weird is that when I try to access the textbox on the server, it send but just gives the basic text that is in the textbox before it is edited, sooo…

you also arent updating the “text” property of the textbox, (which is why its sending the default text)

please use this for some documentation

I’m not sure I understand. The whole point of the localscript is to send whatever is in the textbox to the serverscript with a remote event.

this should work

local rem = game.ReplicatedStorage:WaitForChild("Server")
local rem2 = game.ReplicatedStorage:WaitForChild("Client")

local textbox = game.Workspace:WaitForChild("Part").SurfaceGui.TextBox
local message = textbox.Text

textbox.FocusLost:Connect(function(enterPressed, inputObj)
   if enterPressed then
       message = textbox.Text
   end
end)

rem.OnClientEvent:Connect(function()
	rem2:FireServer(message)
end)

Also, after adding a few print() scripts in, the localscript is fired, but it seems like it can’t access the textbox?

Still doesn’t work, is it possible that the localscript is in the wrong location…?

hm, where do you have it placed right now

ReplicatedStorage, I can’t think of anywhere else where it could go.

thats why, put it in something like StarterGui

Okay! The client now responds, but I get a 400 error (Bad Request) from the server script. Is there a defined reason for this, or am I encoding it wrong?

let me see your server script, you havent sent it after updating it with the proxy

Okay, here it is.

local http = game:GetService("HttpService")
local cooldown = false
local rem1 = game.ReplicatedStorage:WaitForChild("Server")
local rem2 = game.ReplicatedStorage:WaitForChild("Client")

script.Parent.Parent.Parent.Send.SendGui.TextButton.MouseButton1Click:Connect(function()
	rem1:FireAllClients()
	print("client fired")
	rem2.OnServerEvent:Connect(function(message)
		print(message)
		local Data = {
			["content"] = message
		}
		Data = http:JSONEncode(Data)
		http:PostAsync("https://webhook.lewisakura.moe/api/webhooks/removedthetokenandstuffbcduh", Data)
		cooldown = true
		wait(60)
		cooldown = false
	end)
end)

you used the converter on the proxy website right?

Yeah, I did. I’m trying printing the Data Variable out rn.

oh wait actually you use the remote lmao

im not sure what the problem is, try doing this?

script.Parent.Parent.Parent.Send.SendGui.TextButton.MouseButton1Click:Connect(function()
	rem1:FireAllClients()
	print("client fired")
end)

rem2.OnServerEvent:Connect(function(message)
	print(message)
	local Data = {
		["content"] = message
	}
	Data = http:JSONEncode(Data)
	http:PostAsync("https://webhook.lewisakura.moe/api/webhooks/removedthetokenandstuffbcduh", Data)
	cooldown = true
	wait(60)
	cooldown = false
end)

That’s weird, when I print the data variable, it gives me {“content”:null}. And when I print the message variable, it gives me the players name…? Let me try changing the local script rq.

I FIXED IT!! All I had to do was add a player variable to the recieveing remote event of rem2, and it worked! Tysm for the help :heart:

i didnt see that, i guess im blind

1 Like