Is there a way to get a list of the games that are in a certain Group by Group Id?
Here’s an API endpoint that you can use:
https://games.roblox.com/v2/groups/GROUP_ID/games?accessFilter=2&limit=10&sortOrder=Asc
Here’s examples for both JavaScript (e.g. making something like a bot for Discord or Guilded) and Luau (for use in Roblox):
JavaScript example
const groupId = /* YOUR GROUP ID HERE! */;
const limit = /* Maximum amount to return */
const url = `https://games.roblox.com/v2/groups/${groupId}/games?accessFilter=2&limit=${limit}&sortOrder=Asc`;
//when you need it...
async function getGroupGames() {
let response = await fetch(url, {
method: "GET"
});
//if failed
if (!response.ok) {throw new Error("Failed with code:" + String(response.status))};
//get the response JSON
let data = await response.json().data;
//iterating over each game's data
for (let key in data) {
//this contains a bunch of useful information. For example, 'id' is the game's ID and 'name' is the game's name.
};
};
//example
getGroupGames().catch(error => console.log(error));
Luau Example
local httpService = game:GetService("HttpService")
local function getGroupGames()
local success, response = pcall(httpService.GetAsync, httpService, --[[url with group id and limit substituted in. it'll be the same as in other example.]])
if (not success or (response.StatusCode < 200 or response.StatusCode > 300)) then warn("FAILED:", response.StatusCode) return nil end
local data = httpService:JSONDecode(response)
for _, v in next, data.data, nil do
--game data is here
end
end
For use in Roblox, you will need to use a proxy. Hope this helps!
Yes, you can use the GroupService to get a list of games in a certain group by Group ID. Here’s an example of how to do it:
local GroupService = game:GetService("GroupService")
local groupId = 1234567890 -- Replace with the actual Group ID
local games = GroupService:GetGroupInfoAsync(groupId).Games
for _, game in pairs(games) do
print(game.Name)
end
This code uses the GetGroupInfoAsync method to retrieve information about the group with the specified Group ID. The Games property of the group info table contains a list of games in the group. You can then loop through this list to print the names of the games.
Note that the GetGroupInfoAsync method returns a StandardPages object, which contains a list of group info tables. You can use the GetCurrentPage method to get the current page of results, and the AdvanceToNextPageAsync method to move to the next page.
If you need to get the list of games in a group by Group ID and then perform some action on each game, you can use the following code:
local GroupService = game:GetService("GroupService")
local groupId = 1234567890 -- Replace with the actual Group ID
local function onGroupInfo(groupInfo)
for _, game in pairs(groupInfo.Games) do
-- Perform some action on each game
print(game.Name)
end
end
local function onError(error)
print("Error:", error)
end
GroupService:GetGroupInfoAsync(groupId).Then(onGroupInfo, onError)
This code uses a closure to define a function that will be called with the group info table as an argument. The onGroupInfo function loops through the list of games in the group and performs some action on each game. If an error occurs, the onError function is called with the error message as an argument.
GetGroupInfoAsync
doesn’t return the games made by a group.
That’s the only part I got confused on so I had to ask someone how to use that and they recommended that.
Yeah, I know. I stated that in my post here, but edited it out because it sounded a bit accusatory. Annoying how people copy and paste AI, if the OP wanted an AI response they could just type it into AI themselves.
Bruh I have a friend in cyber security helping me out with all this. I have help and none of it is ai generated. Now stop bringing me down, all i’m trying to do is help. What’s wrong with that?