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

How would i check if a game has HttpsService enabled or not?

Asked by 5 years ago

Ok so i am working on a public script and i am wondering on how i can check if the game the script is being ran in has HttpsService enabled, the script will need HttpService for some functions and i would like to warn the owner of the problem, all i need help with is to check if the game has HttpsService is enabled. Thanks anyone who awensers.

0
I also saw F3X tools with this feature so i know its possible. spicychilly2 145 — 5y
1
Use pcall() when sending a HttpRequest. If it fails, HttpService is disabled. (There might be other reasons too.) JakyeRU 637 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago
local HttpService = game:GetService("HttpService")

local CheckHttp = function()
    local Set = false
    pcall(function()
        if HttpService:GetAsync("https://www.test.com/") then
            Set = not Set
        end
    end)
    return Set
end

if CheckHttp() then -- returns either true or false
    print('works!') else print('uh oh it doesnt work!')
end

Pretty simple actually, pcall comes useful to situations such as these, as JakyeRU said to use pcall. This is an example, hope you learned a thing.

Ad
Log in to vote
0
Answered by 5 years ago

You can use the command bar in Roblox Studio to check if HTTP requests are enabled in a game:


print(game.HttpService.HttpEnabled) -- Returns a boolean determining if HTTP requests are enabled
0
That only works in the command bar, i need it in a script spicychilly2 145 — 4y

Answer this question