Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

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.

Ad
Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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.

Log in to vote
-1
Answered by
ABK2017 406 Moderation Voter
5 years ago
Edited 5 years ago

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)

0
Then why would it work in Studio but not in game? ChasingNachos 133 — 5y
0
your not susposed to put local scripts into the workspace Oxygen4Lyfe 408 — 5y
0
Where should I put the script then? ChasingNachos 133 — 5y
0
^Players character or startergui Troxure 87 — 5y
0
HttpService is server-side only. Also this should be a comment, and Trello should NOT be usef as a database. User#19524 175 — 5y

Answer this question