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

Is there a way to detect if a game doesn't have Studio Access to API Services?

Asked by 5 years ago

I've got a Plugin which is heavily dependent on Studio being able to access the API Services is there a way to detect this being disabled and then I can prompt the user to turn it on or the Plugin won't work?

Does this have to do with this?

game.HttpRbxApiService
0
It will automatically tell the User that the API Service isn't enabled if a call fails. Ziffixture 6913 — 5y
0
I know that it has an error in Output but I mean to detect it disabled and then I can show a little UI at the corner saying the plugin wont work since its disabled Cryo_Dev 9 — 5y
0
maybe try using pcall and get the service in the pcall. then you could do "if not service then" to see if the service is fetched the8bitdude11 358 — 5y
0
or not the8bitdude11 358 — 5y
0
I explained how to use pcall() in my answer. OptimisticSide 199 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

HttpRbxApiService is a modified version of HttpService used by Roblox Admins.

We can find out if code is properly run using the pcall() function. To find out if http service works, try this in studio:

local hs = game:GetService("HttpService")
local success,fail = pcall(function()
    hs:PostAsync("http://www.google.com")
end)
if success and not fail then
    print("Http works!")
else
    print("Something went wrong!")
end

If this helped, accept the answer so we both get reputation! :)

0
I'll give it a try Cryo_Dev 9 — 5y
0
See message below for problem I've incountered with this. Cryo_Dev 9 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

I've given your answer a go but it appears it's just triggering as failed each time even if the API Services have access see screenshot below.

Screenshot

Here is a screenshot of the error note I added my custom error message and it was still doing the same even without my custom error message.

Screenshot

0
Are you connected to the internet? OptimisticSide 199 — 5y

Answer this question