I have a textbutton and you click it and its supposed to open a frame ONLY if you have a gamepass, but it doesnt work? Why not though..
local frame = script.Parent.Parent.Parent.TeleportFrame
local player = game.Players.LocalPlayer
local id = 7617401
script.Parent.MouseButton1Click:Connect(function()
if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, id) then
frame.Visible = not frame.Visible
else
game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id)
end
end)

1 comment
Use PlayerOwnsGamePassAsync.