HTTPService bug

So I decided to make a webhook on discord that messages you when a player joins in a game, and I added an extra feature which allows players to DM you directly, but there’s a bug…

As you can see there’s a bug on the actual server saying: roblox http requests are not enabled, but my HTTP service is already enabled.

But when I run the game on Roblox studio…
It work’s perfectly! I don’t even know what I’m doing wrong right now…

Discord blocks requests from Roblox web servers because some developers were misusing the feature.

https://devforum.roblox.com/t/http-post-requests-to-discord-api-failing/97008

2 Likes

That would give a different 401 error. This is an error saying HTTP requests aren’t enabled.

Any solutions for this error?

Can you run this in the command bar?

print("HttpEnabled:" .. tostring(game:GetService("HttpService").HttpEnabled))

You may need to enable it for the game through the game settings panel, if you haven’t already.

I already did

Anyways here’s my webhook script

local HTTP = game:GetService(“HttpService”)
local Key = “########”
local HookData = {
[‘content’] = “”;
}

– Join Webhook
local player = game.Players.LocalPlayer
repeat wait(1) until player ~= nil
–HookData.content = (“" … player.Name … "” … " has joined the server!“)
–HTTP:postAsync(Key, HTTP:JSONEncode(HookData))
– Feedback/Comment Webhook
function Submit()
HookData.content = (”**" … player.Name … " has sent you a feedback: “… script.Parent.TextBox.Text …”")
HTTP:postAsync(Key, HTTP:JSONEncode(HookData))
end
script.Parent.TextBox.SubmitButton.MouseButton1Click:connect(Submit)

Before or after you published your game to the website?

OH CRAP!

Server only:This object is server-side only! You should use a Script instead of a LocalScript when using it.

I didn’t notice it xD! problem solved!

1 Like

Hide your webhook URL from the public :cold_sweat: (and get a new one afterwards)

8 Likes

Discord blocks requests from Roblox now. You can still get around this with your own proxy.

That wasn’t the issue. The issue was already solved, they were trying to use HttpService from the client.

Oh, I didn’t notice that.
@szkiller_dev be sure to mark your post above as the solution