How would I be able to retrieve another game's universe ID from its place ID

The title basically explains the whole thing. However I couldn’t find a post that actually explains how to print out the universe ID from a place id. This one:

I used a code sample however it doesn’t show how would I get the data from the json and print out the universe id from the place id.
I’m extremely new to using json so please go easy on me!

Code:

local HTTP = game:GetService("HttpService")
local gameRequest = "https://api.roblox.com/universes/get-universe-containing-place?placeid=2809202155"

local success2, result2 = pcall(function()
	return HTTP:GetAsync(gameRequest)
end)

if success2 then
	local UniverseId = HTTP:JSONDecode(result2).data[1].universeid
	print(UniverseId)
end

Try this

local HTTP = game:GetService("HttpService")
local gameRequest = "https://api.roproxy.com/universes/get-universe-containing-place?placeid=2809202155"

local success2, result2 = pcall(function()
	return HTTP:GetAsync(gameRequest)
end)

if success2 then
	local UniverseId = HTTP:JSONDecode(result2)["UniverseId"]
	print(UniverseId)
end
1 Like

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