Script works in studio but not in game

Hello.

Basically, I’m trying to send a message to my discord server’s moderator logs everytime I want to. This works perfect in studio, but when I try it out in game it throws a “Http 403 (Forbidden)”
error.

Module script: (throws error at line 21 where it posts)

local Discord = {}

local url = "you aren't seeing this"

local HttpService = game:GetService("HttpService")

local isStudio = game:GetService("RunService"):IsStudio()

function Discord:Send(message)
	local dt = DateTime.now()
	local studio = "Not In Studio"

	if isStudio then studio = "In Studio" end
	
	local otherMessage = "("..dt:FormatLocalTime("LLLL", "en-us")..", "..studio..")"

	local messageData = {
		["content"] = tostring(message).."\n"..otherMessage
	}
	
	local success, err = pcall(function()
		HttpService:PostAsync(url, HttpService:JSONEncode(messageData)) -- post the message
	end)
	
	if not success then
		warn(err)
	end
end

return Discord

The second script is me using the function Discord:Send(player.Name.." has joined the game!"). This part works perfectly in studio but creates an error in game.


Image of the error.

And yes, HttpRequests are enabled in the settings.

1 Like

Discord webhooks do not work in the roblox client. discord blocked them

1 Like

Why would they work in studio? And is there any way to get around it?

2 Likes

They work in-studio because it’s your IP. Roblox servers IP are banned. A way to get around it would to use a discord bot (forgot what its called) or run your own https website

3 Likes

Proxies. Search up “Roblox Discord Proxy” and you’ll find one.

2 Likes

They work in studio because it’s being sent from your IP address, not one of roblox’s servers.

2 Likes

Perfect. Found one where replacing the “discord.com” with “webhook.lewisakura.moe” works. Thanks.

1 Like

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