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.
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.