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

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

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.

2 comments

0

I also saw F3X tools with this feature so i know its possible.

1

Use pcall() when sending a HttpRequest. If it fails, HttpService is disabled. (There might be other reasons too.)

2 answers

✓ Accepted answer
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.

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 

1 comment

0

That only works in the command bar, i need it in a script

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