I’m experimenting make gui sohw up when the player buy gampass and its work but i need add anthoer game pass in same frame how i can make this
the script
local Player = game.Players.LocalPlayer
local GamePassId = 738593730
local GamePassService = game:GetService("MarketplaceService")
local ocbutton = script.Parent
local GPCS = script.Parent.Parent.GPCS
local Be = false
ocbutton.MouseButton1Up:Connect(function()
if GamePassService:UserOwnsGamePassAsync(Player.UserId,GamePassId) then
if Be == false then
Be = true
GPCS.Visible = true
script.Parent.Parent.Sedan.Visible = false
script.Parent.Parent.Suv.Visible = false
else
GPCS.Visible = false
Be = false
end
else
GamePassService:PromptGamePassPurchase(Player,GamePassId)
end
end)
Is the best way to put them in an external group and extract them? Or is there a way to use names that do not require manual coding?
You need to use MarketplaceService to check if the player owns game passes and prompt purchases. This version of the script checks if the player owns either of the specified game passes. If so, it shows a GUI frame (GPCS ); if not, it prompts the player to purchase the first game pass.
local Player = game.Players.LocalPlayer
local GamePassId1 = 738593730
local GamePassId2 = 123456789 -- Replace with your second game pass ID
local GamePassService = game:GetService("MarketplaceService")
local ocbutton = script.Parent
local GPCS = script.Parent.Parent.GPCS
local Be = false
ocbutton.MouseButton1Up:Connect(function()
if GamePassService:UserOwnsGamePassAsync(Player.UserId, GamePassId1) or GamePassService:UserOwnsGamePassAsync(Player.UserId, GamePassId2) then
if Be == false then
Be = true
GPCS.Visible = true
script.Parent.Parent.Sedan.Visible = false
script.Parent.Parent.Suv.Visible = false
else
GPCS.Visible = false
Be = false
end
else
GamePassService:PromptGamePassPurchase(Player, GamePassId1)
end
end)