Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to get a game name from the Roblox api?

I've tried this but it does not work and just says the link is not trusted or something.

PlaceId = game.PlaceId
HttpServ = game:GetService('HttpService')
GAsync = HttpServ:GetAsync('https://api.roblox.com/Marketplace/ProductInfo?assetId='..PlaceId,true)
Info = HttpServ:JSONDecode(GAsync)
local PlaceName = {}

for i,v in pairs(Info) do
		if v.name:find("Name") then
			for j,b in pairs (Info) do
				table.insert(PlaceName,b.name)
			end
			end
end

print(PlaceName)

2 answers

✓ Accepted answer

There's MarketPlaceService, which has GetProductInfo. This may be (EDIT: is exactly) what you're looking for.

EDIT: Example:

local placeId = 862942316 -- https://www.roblox.com/games/862942316/pb
local Asset = game:GetService("MarketplaceService"):GetProductInfo(placeId)
print(Asset.Name) -- correctly prints pb

Httpservice cannot be used when trying to access anything from the domain roblox.com. Maybe a workaround for this is to send a get request to one of your server which from there will get the json from the site on the server and then return it to Roblox, like the middle man.

1 comment

0

To bypass this limitation, third-party proxies are often used. I would direct you to either https://rprxy.xyz/ or http://roblox.plus:2052/api , but both are currently unavailable.

This discussion is preserved as it was. New answers, comments, and votes are closed.