How can I check if HTTPservice is enabled with scripts?

So I have a script that runs something that needs https service, basically a whitelisting system.

How can I get the script to check if http requests are enabled instead of getting an error and stopping completely?

You could try using pcall, and test by sending HTTP request to a website (for example, example.com), then check if there was an error. It is a bit hacky solution though.

HttpService.HttpEnabled property may help

edit: disregard my solution, it’s a local user security property

You could use

local HTTPService = game:GetService("HttpService")
local Success, Result = pcall(HTTPService.GetAsync, HTTPService, "https://www.roblox.com/")
if not Success and Result == "Http requests are not enabled. Enable via game settings" then
	--> HTTP Disabled
end

It sends a GET Request to roblox.com using pcall, If it errors that means HTTP Requests are disabled.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.