How do i get string from website?

  1. What do you want to achieve? Keep it simple and clear!
    Getting a string from a website
  2. What is the issue? Include screenshots / videos if possible!
    I cant find any way to do it.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
local HttpService  = game:GetService("HttpService")
local response = HttpService:GetAsync("example.com")

local data = HttpService:JSONDecode(response)

print(data.StatusCode)

i tried this but then i realised this dosent work i get this error:
The current identity (2) cannot HttpEnabled (lacking permission 3)
but then i realised this wont work i am not sure what i can do

You need to enable HTTP requests in game settings.

I now get this error:

The current identity (2) cannot HttpEnabled (lacking permission 3)

but will this get the string from the website?

Make sure this is a server script, and that the domain is an actual domain that it can get a string from.

It is a Server script and the domain is an actual domain. but does this function get the string like the actual string from the website?

like i have a website that says “hello” will it print hello?

Scripts and LocalScripts cannot set the HttpEnabled property, you will either have to enable it through the game settings or run game:GetService("HttpService").HttpEnabled = true inside the command bar when the simulation is not running.

i actually already had that code inside the script on the top

Remove it from the Script and run it in the command bar. The reason the error occurs is because that script attempts to run that line and it doesn’t have permission to set HttpEnabled(that line must be removed from your script).

Thought that enabling that in the game settings would set that to true, weird.

Yeah, it will print hello if correctly done.

Thank you soo much! i will flag this as solved!

The reason it fails is because their trying to set it through a script running within the simulation.

No problem! I’m willing to help on any future web endeavors.

It does, but in this case the original poster had not allowed for Http requests to be made from his game in the security tab of his game’s settings window.