You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I wanna know how can I get all the gamepasses found in a game, from a script or an API.
What is the issue? Include screenshots / videos if possible!
I tried using every single API I found, but none of them worked…
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I searched everywhere, on youtube, devforum, but I found nothing
local httpService = game:GetService("HttpService")
local gameID = game.GameId
local baseUrl = "https://games.roproxy.com/v1/games/%s/game-passes?limit=100&sortOrder=Asc"
local URL = baseUrl:format(gameID)
local response
local jsonData
local success, err = pcall(function()
response = httpService:GetAsync(URL)
end)
if success then
jsonData = httpService:JSONDecode(response)
print(jsonData.data[1].name)
else
print(err)
end
This code uses the RoProxy endpoint to get the gamepasses.
If you want to do this with other games, you will need to get their UniverseID. To do this, you can visit the endpoint below and replace PLACEID with the game’s PlaceID.
FROM:
TO:
Then you can change the variable gameID to the numbers displayed in the brackets.
I completely forgot about JSONDecode which can be used in this scenario to get bits of data from the string. I have updated the code which now uses JSONDecode.