How to get an asset Id from a string?

I want the player to be able to type a game name and my game will be able to get its asset Id, in order to load the game page; Is this possible?

By asset id? you mean the numbers only or the link?

Yes, I want to be able to get a game’s id by its name.

Worth noting that any place roblox place can have any name, so you most likely want the user to display a list of a few searches found at least.

You can use this API endpoint by sending a GET request:
https://games.roblox.com/v1/games/list?model.keyword={keyword}
Where:

  • {keyword} is the name to search for games containing that keyword

You can see the documentation here, if you want


NOTE: Because this is part of roblox’s domain, sending requests from your scripts on a player client will be blocked. If you want to get around this, you would want to use a proxy server and I would highly recommend running your own proxy server. A proxy server is a middleman - you send requests to the proxy server’s uri, then that server will forward requests to roblox’s API endpoints where the proxy server will then return the exact response from the endpoint.


The endpoint returns an object with a games property/index which is an array that contains objects that lists information about places obtained based on the search keyword. The endpoint naturally returns a json encoded string, so the string has to decoded from a json string to a lua table.

Here is an example:

-- This script wouldn't work because you're attempting to send directly
-- to roblox's domain. You have to use a proxy
local url = "https://games.roblox.com/v1/games/list?model.keyword=%s"
local res = HttpService:RequestAsync{
    Url = url:format(keyword),
    Method = "GET"
}

local resBody = HttpService:JSONDecode(res.Body)

for _, gameData in ipairs(resBody.games) do
    print(gameData.placeId, gameData.name, gameData.creatorName) 
end

Use string.match with %d+ as the match string.

string.match('https://roblox.com/games/21532277/Notoriety', '%d+')