I need help with this.
I appreciate all kinds of help
I don’t think so. If it was the other way round, it would be possible.
Afaik there is no API to list places from a universe Id either (correct me if I’m wrong)
Hi there,
Looking further into Roblox’s Games API V1, I’ve put together these 2 functions for you that convert UniverseId
into PlaceId
and the other way around. I initially thought this type of conversion this way around wouldn’t be possible, but apparently it is.
Hope it’ll work to suit your needs. Let me know if you run into any issues.
Good luck.
-- ServerScript
local HttpService = game:GetService("HttpService")
local function getPlaceIdfromUniverseId(universeId:number)
if not tonumber(universeId) then return nil end
local data
local success, response = pcall(function()
data = HttpService:GetAsync("https://games.roproxy.com/v1/games?universeIds="..universeId)
end)
if success and data then
data = HttpService:JSONDecode(data)
return data["data"][1]["rootPlaceId"]
end
end
local function getUniverseIdfromPlaceId(placeId:number)
if not tonumber(placeId) then return nil end
local data
local success, response = pcall(function()
data = HttpService:GetAsync("https://apis.roproxy.com/universes/v1/places/"..placeId.."/universe")
end)
if success and data then
data = HttpService:JSONDecode(data)
return data["universeId"]
end
end
local placeId = getPlaceIdfromUniverseId(111958650)
local universeId = getUniverseIdfromPlaceId(placeId)
local placeName = game:GetService("MarketplaceService"):GetProductInfo(placeId).Name
print("placeName: "..placeName.." | ".."placeId: "..placeId.." | ".."universeId: "..universeId)
There’s an in-engine solution: GetGamePlacesAsync. Give it a game id and it will return a StandardPages object of place ids associated with the game. If you need the inverse, Roblox provides GameId to identify the id of the game that the current place is associated with.
Really thanks! it works perfect, I appreciate the help of those who posted. I will post again soon when I add the feature to the game and update it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.