i want to make a script that gets every gamepass from the game without having to hardcode/script each gamepassid manually
local marketplaceservice = game:GetService('MarketplaceService')
local gamepasses = {810807833, 802697590}
for _, gamepass in pairs(gamepasses) do
local asset = marketplaceservice:GetProductInfo(gamepass, Enum.InfoType.GamePass)
local template = gamepasstemplate:Clone()
template.Parent = gamepassesframe.Frame
template.Name = asset.Name
template.GamepassName.Text = asset.Name
template.GamepassDescription.Text = asset.Description
template.robux.GamepassPrice.Text = asset.PriceInRobux
template.GamepassIcon.Image = 'rbxassetid://' .. asset.IconImageAssetId
end
is there any way to make the script get all gamepasses automatically without having to manually insert each id in (if you cannot solve this it is fine i just wanna kinda prevent annoyances in the future)
local LocalPlayer = game.Players.LocalPlayer
local marketplaceservice = game:GetService('MarketplaceService')
local gamepasses = {810807833, 802697590}
for _, gamepass in pairs(gamepasses) do
local asset = marketplaceservice:GetProductInfo(gamepass, Enum.InfoType.GamePass)
local template = gamepasstemplate:Clone()
template.Parent = gamepassesframe.Frame
template.Name = asset.Name
template.GamepassName.Text = asset.Name
template.GamepassDescription.Text = asset.Description
template.robux.GamepassPrice.Text = asset.PriceInRobux
template.GamepassIcon.Image = 'rbxassetid://' .. asset.IconImageAssetId
--[[
you already did it tbh, i believe this code is for passes ui so if you dont have image button, text button you're required to make one here is addition for your code
(so for i,v loop you already check the gamepasses ui all you need to do is to add button)
]]--
template.button.MouseButton1Clicked:Connect(function()
if marketplaceservice:UserOwnsGamePassAsync(LocalPlayer.UserId, gamepass) == true then --gamepass present as gamepass id
print("owned")
else
marketplaceservice:PromptGamePassPurchase(LocalPlayer, gamepass)
end
end)
end
I don’t think so, but to get all the game passes:
There is a Web API for this https://games.roblox.com/v1/games/universeId/game-passes?limit=100&sortOrder=Asc
Use HttpService to post HTTP requests. There’s plenty of tutorials related to this already for Discord Webhooks, so I would recommend looking there for help on how to use HTTPService if the documentation isn’t sufficient