Bit lazy , i want it that every gamepasses new or old will automatically have a template into a shopping page in my game
What do you mean by that, If you’re too lazy to explain yourself don’t expect others to help
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.
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.
Any forums about this, what to do with it? What to do with it to get the ids and names
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
I know those parts, just want to know what to do with it to retrieve the gamepass ID, gamepass Name
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.
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
Did that, got an error page sadly.
Do you already have gamepasses out?
Yeah, anyways i tested that script. it made a template but although how can i get the userid and maybe the gamepass image?
For that I think it’s something else, Let me check the API.
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…