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

What is "HTTP Requests?" How can I use them?

Asked by
2Loos 168
3 years ago

I've seen this everywhere, from the F3X plugin to Discord feedback GUIs. How does this work? What does it do, and what is it used for in general? I have no code for this, as I don't even know what it does. I want to know what it can do.

0
They're used to allow HTTP Requests between websites such as Discord. If you turn them on Studio, you allow the HTTP Requests. This is typically done using HTTPService. Dovydas1118 1495 — 3y

1 answer

Log in to vote
3
Answered by
Optikk 499 Donator Moderation Voter
3 years ago

HTTP (hypertext transfer protocol) requests used outside of Roblox are most often used for communicating information from websites to you. In Roblox, you can use HTTP requests to communicate with endpoints or read information from a website. Roblox exposes HTTP methods through HttpService.

Here is an example, using :GetAsync(). Give it a try! Remember that you must enable HttpRequests in your game and must use a normal Script, not a LocalScript.

local HttpService = game:GetService('HttpService')
local Url = 'http://www.example.org/example.txt'

local response = HttpService:GetAsync(Url)
print(response)

HttpService's main advantage is enabling developers to communicate to something outside of Roblox. I've seen it used primarily for logging, using Discord webhooks (even though it's discouraged), saving player data outside of roblox, or for game analytics.

0
Wow, I never knew. I can set up moderation and chat logs and directly view it in Discord! That's amazing, I never knew! Thank you for the detailed response! 2Loos 168 — 3y
Ad

Answer this question