Issue using webhooks

Hello. I am trying to create a system to suggest things that will be sent to a discord channel, but this code just doesn’t do anything. I know it’s running since it’s printing stuff, and I’ve tested this just running when the game starts, and it works, so I don’t understand why it doesn’t work when connected to a remote event. Any help would be appreciated. Thank you!
Script:

local HTTP = game:GetService("HttpService")

local webhookurl = --Not sure if it's safe to share webhook links here, but I know the link is valid so that's not the issue

game.ReplicatedStorage.GameEvents.Suggest.OnServerEvent:Connect(function(player, text)
	print(player, text)
	local data = {
		["embeds"] = {{
			["author"] = {
				["name"] = player.Name .. "'s Suggestion" ,
				["icon_url"] = "https://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&username="..player.Name
			},
			["description"] = "Suggestion: " .. text,
			["color"] = tonumber(0xFFFAFA),
			["fields"] = {
				{
					["name"] = "User ID:",
					["value"] = player.UserId,
					["inline"] = true
				}
			}
		}},
	}
	local finaldata = HTTP:JSONEncode(data)
	HTTP:PostAsync(webhookurl, finaldata)
end)

Edit: The system works in Roblox Studio but not in the actual game. Does it have something to do with the game being private?

Discord webhooks no longer work from Roblox servers, Discord blacklisted them.

Dang. Any other good way to log stuff from in game? I saw a post about a module called ProxyService but it looked absurdly confusing lol

You would have to proxy the requests through your own, or some other existing(?) web server. It just can’t come from a Roblox Server IP. That module may be communicating with someone’s proxy server.

Basically you need to make a web server that you can send a request to with the information you want to pass along to Discord and that endpoint on your web server “proxies” the request and sends it along to Discord. It’s a bit involved but if you have a place to host a web server and if you’ve built an API in a web server before it’s relatively trivial.

Yeah, I’ve got none of that. I’m pretty sure that’s what ProxyService was intended to do, just mostly making it easier. I guess that’s my only option. Thanks for your help

I don’t recommend using discord webhooks for a Roblox game because if discord webhook goes above the limit / gets spammed there’s the chance that your discord account can get suspended.

They’re blocked anyway. Discord doesn’t accept requests from Roblox. I don’t how before the change it would get your account suspended, though.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.