Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Checking if HttpEnabled is set to true/false?

I've tried a few methods such as:

if game.HttpService.HttpEnabled then
	print("HttpService is Enabled")	
end

I was wondering if there was any way to check if the 'HttpService' is enabled or not, not to change it but just to simply see if it is enabled/disabled.

1 answer

✓ Accepted answer

##Problem

For one reason or another Roblox will not even allow scripts to read if HttpEnabled is enabled or not. My guess would be it is for security reasons and do not want exploiters to try and disable it by any means.


##Solution

Fortunately Epix Incorporated have a trick in their admin script that will allow detection if HttpService is enabled or not. What Epix does is, it calls a function. That function will send a GetAsync request to google.com (it's google, when was the last time they completely went offline) inside a protection call function. They then return the result of that function to detect if HttpService is enabled.


##Final Script

function HttpEnabled()
    local s = pcall(function() --Pcall will return two results from a function. Boolean if the function executed successfully, and the error if applicable.
        game:GetService('HttpService'):GetAsync('http://www.google.com/') --GetAsync will return an error if HttpEnabled is disabled, or by the off chance google actually goes offline.
    end)
    return s --This will be true or false depending if the GetAsync yeild function ran successfully or not.
end

######Hopefully this answered your question, if so do not forget to hit the accept answer button. If you have any questions feel free to comment below.

1 comment

0

I was just about to post this exact solution haha

This discussion is preserved as it was. New answers, comments, and votes are closed.