I’m developing a game that allows players to share their own creations. Currently, I’m grappling with the challenge of retrieving games from the groups that players belong to. My attempts to find a solution online primarily led me to utilizing APIs, but it appears that this approach is no longer viable. I’m at a loss regarding alternative methods to achieve this. While I’m proficient in coding, I’m seeking guidance on the conceptual level to understand how to fetch the games effectively. Any insights or ideas would be greatly appreciated.
You should use the Games API, specifically the following endpoint:
https://games.roblox.com/v2/groups/{groupId}/gamesV2
, you should use HttpService to make a GET request using HttpService:GetAsync()
and decode the JSON response using HttpService:JSONDecode()
. You will have to specify an access filter: 1, 2 or 4. 1 returns an internal server error and 4 is not implemented so your choice should be 2. After that, you can specify a sort order and a limit, take into account that the max limit is 100 which could be an issue if you’re trying to get the games of a group with over 100 games, that’s where you’ll have to use a pageCursor
which basically determines in what page you are and allows you to get games from specific pages, in this case you will want to get all of the games. Here’s a code example:
local HttpService = game:GetService("HttpService")
local GroupId = 0
local accessFilter = 2
local limit = 100
local Endpoint = `https://games.roproxy.com/v2/groups/{GroupId}/gamesV2?accessFilter={accessFilter}&limit={limit}`
local response = HttpService:JSONDecode(HttpService:GetAsync(Endpoint))
print(response)
This code example doesn’t use page cursors as I couldn’t find a group with as many games as needed to get a cursor but it should be enough for now.
It uses RoProxy as Roblox doesn’t allow HTTP request to its own servers from games.
Thank you so much! It works! But I have one last question if you don’t mind before I end this topic. I was searching for RoProxy APIs as you said Roblox doesn’t allow HTTP request to its own servers. However, I couldn’t find those… How do I find those RoProxy APIs? Like the “EndPoint”
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.