How can I make a template for all gamepasses in my game?

Bit lazy , i want it that every gamepasses new or old will automatically have a template into a shopping page in my game

1 Like

What do you mean by that, If you’re too lazy to explain yourself don’t expect others to help :confused:

2 Likes

Bit lazy to MANUALLY add all the gamepasses

I want to make a script, or atleast mess with an API to get all the gamepasses under the game this script is added and automatically make templates for each of them.

2 Likes

Oh, I see.
For that there is a specific API “https://games.roblox.com/v1/games/universeId/game-passes?limit=100&sortOrder=Asc

You need universeid for it.

2 Likes

Any forums about this, what to do with it? What to do with it to get the ids and names

2 Likes

You can read more about it here: How do I get UniverseId from PlaceId? (ROBLOX API)

And probably better find some extra information over here: DataModel | Documentation - Roblox Creator Hub

2 Likes

I know those parts, just want to know what to do with it to retrieve the gamepass ID, gamepass Name

2 Likes

It’s very simple, If you enter your universe id at the parameter and paste the link into your browser, You can see the full data.
You just call for it through Roblox and extract the data table from it, All the info you want would be there.

1 Like
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 
    return
end

Took this from another post, would this work?
If so, how would i get the id aswell whats the property of the data

1 Like

Did that, got an error page sadly.

1 Like

Do you already have gamepasses out?

1 Like

Yeah, anyways i tested that script. it made a template but although how can i get the userid and maybe the gamepass image?

1 Like

For that I think it’s something else, Let me check the API.

2 Likes

I think you should just use:

game:GetService("MarketplaceService"):GetProductInfo()

With each gamepass from the table you received, I hope you may succeed with that!

You do realize that requires the assetID not the name…