HttpService not working

I genuinely have no idea what is happening right now.

I’m new to APIs and HttpService, and when this happened, I tried to look on devforum, but nothing.

I was making a test where inputting a PlaceID outputs the UniverseID, but that happened.

Here’s the code:

local service = game:GetService("HttpService")

script.Parent.PassInfo.OnServerEvent:Connect(function(_, text) -- remote event that works
	local formattedUrl = string.format("https://apis.roblox.com/universes/v1/places/%s/universe", text)
	
	print(formattedUrl) -- prints correct api url
	
	success = pcall(function()
		response = service:GetAsync(formattedUrl)
	end)
	
	print(response) -- prints nil
end)

Hi! Did you try printing the full returned arguments of the pcall function? Try running this and see what happens:

local service = game:GetService("HttpService")

script.Parent.PassInfo.OnServerEvent:Connect(function(_, text) -- remote event that works
	local formattedUrl = string.format(
		"https://apis.roblox.com/universes/v1/places/%s/universe", 
		text
	)
	
	print(formattedUrl) -- prints correct api url
	
	success, errorMsg = pcall(function()
		response = service:GetAsync(formattedUrl)
	end)
	if success then
		print(response)
	else
		print(errorMsg)
	end
end)

The HTTP service can’t access Roblox resources, i.e. anything on the roblox.com domain. You’ll need to use a proxy of some kind if you want to access it.

1 Like

@kylekylesa14 Here is roproxy, a common proxy.

Although you might need to configure cache if needed.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.