Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Discord Webhook only working in ROBLOX Studio and not in the game?

I made a script in ServerScriptService to post a message on a Discord channel. It creates a message when a player enters the game. It works in studio, but not in the game. I already tried putting it into a LocalScript into Workspace, but it failed. CODE:

local url = "https://discordapp.com/api/webhooks/479667015276167181/RSWm3A0TaH6i3R-2tzvTDIxuTitQvp-elE7smf0xd_Kdb55Rfza-t2cO_REQ2fsUGTfq"

local http = game:GetService("HttpService")

local HookData = {

['username'] = "HD ACTIVITY NOTICE",

['content'] = "@everyone Players are active in HD Admin House. Please come on down to the server to moderate!"

}

HookData = http:JSONEncode(HookData)

http:PostAsync(url, HookData)

3 answers

✓ Accepted answer

Since Roblox's servers are no longer authorized to send POST requests to Discord's servers you'll have to use a proxy. Read more about that here.

The reason why you don't have to use a proxy in Studio is because all HTTP requests from Studio test environments are initiated through your home network.

You can't use HttpService on the client.

Even if you used a server script in live servers, you would receive a 403 forbidden error. Read my answer here.

Discord blocked ROBLOX webhooks due to abuse.

"Because over the past week, 88% of requests from the “Roblox/WinInet” that hit our API were invalid. We’ve decided to block the user-agent from talking to our API out-right." (Tweet)

"Specifically, sections 2.6 and 2.7 of our API Terms of Service were being violated, 2.6 because distributing tokens in plugins is not allowed, and the ROBLOX http client does not return headers/status codes, making it impossible to build a script compliant with our API Tos (2.7)." (Tweet)

5 comments

0

Then why would it work in Studio but not in game?

0

your not susposed to put local scripts into the workspace

0

Where should I put the script then?

0

^Players character or startergui

0

HttpService is server-side only. Also this should be a comment, and Trello should NOT be usef as a database.

This discussion is preserved as it was. New answers, comments, and votes are closed.