HttpService returning nil

So I am pretty new to httpservice and I have this script I found by roblox(modified a bit)

local HttpService = game:GetService("HttpService")

local URL = "https://groups.roblox.com/v1/groups/6094444/users?sortOrder=Asc&limit=100"

local data
local response
 
local function printData()
	pcall(function ()
		response = HttpService:GetAsync(URL)
		data = HttpService:JSONDecode(response)
	end)
	return true
end
 
if printData() then
	print(data)
	print(response)
else
	print("Something went wrong")
end

But both of the values keep returning nil, Could someone help me?

You can’t access the Roblox endpoints from Roblox game servers. Unfortunately, you will need a proxy service to fulfill your requests.

1 Like

You cant send any requests to Roblox sites. Use a proxy or something,

You can’t send HTTP requests to any *.roblox.com site such as api.roblox.com and groups.roblox.com.

This is due to security reasons. There is a service called HttpRbxApiService which can access *.roblox.com but it is only available in CoreScripts.

Here is my solution: I have a backend running in Google Cloud (pretty cheap, only 5€ a month) which acts as a proxy to Roblox API endpoints. There are free ones as well, as @wevetments mentioned.

1 Like