Create a HTTP request outside serverscriptservice

Hello! I’m currently new to the entire roblox coding community, and I’m testing a few things. I’m wondering now, I’m creating a script that should send a Http request to

-- Settings --Http
local webhook = "https://discordapp.com/api/webhooks/727146597334384710/Y-g2KgOadDS74h_281KaiWuWl_wiPbE7I3fdKbAg"
-- Variables --
local HTTP = game:GetService("HttpService")
	local payload = HTTP:JSONEncode({
		content = S1.InputBox.Input.Text, -- This is the text given in the actual script --
		username = player.Name.. " - **``A Quiz List :O``**"
	})
	
	HTTP:PostAsync(webhook, payload)
	

This is what I’ve currently got (Don’t even try the webhook, it’s invalid).

My question, I’m importing the script into a live game (Something like “;eval” command)

This means some scripts aren’t being executed from the server side.
This is my current tree:

Everything is in the GUI currently, how could I send a HTTP request to a discord webhook like this?

What are you trying to send here though?

A string with the awnsers someone given in a quiz

You can just get the string from the path and send it?
EDIT: Can you provide more info of what exactly you want to send?

You can only send HTTP Requests from the Server if I’m not mistaken, just use a RemoteEvent, send the answers as either a table or multiple parameters, construct the data on the server, and send the request from the server.

EDIT: If you would like to send your message with an embed, here is a good source on how to send them. For the color part, its converted into decimal form

2 Likes

You can send HTTP requests only if:
1.The Parent of Ascendent is ServerScriptService
2.The Parent of Ascendent is Workspace

So you should just send all input you want to send using the Remote Event it self

RemoteEvent:FireServer(S1.InputBox.Input.Text,S2.InputBox.Input.Text,S3.InputBox.Input.Text,[And So On])

Sure this might be Lengthy but it can work out

> [You will need to accept all input from other side]

The problem I’m having right now, everything has to be in the same model to be imported into the game.

It’s being imported into a live game like:
;s require(NUMBER):SetExecutor("username")

After that you can do module/sendquiz <player>. This popsup the GUI

Id you’d like to test it for yourself:
Get this script in a place:

And Get this one:


And when it loads in (You should see a scythe in the bottom right) do:

;s require(5233577697):SetExecutor("your_playername")
and say in chat:
module/sendquiz me

EDIT:
StefanoMod is the entire module I’m using, you should be able to see the RequestGUI in mainmodule, along with the scripts (DiscordLogic and the config and logic script)

Can you explain more on what exactly you will be sending to Discord using Webhook like just what is the main problem

Thanks for the help, it seems I’ve solved the problem (Not being able to send http request outside server scripts) through the events