Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a text button prompt a gamepass?

I tried making one and all it does is say "this item is not for sale." How do I make it work? Script Attempt:

local MarketplaceService = game:GetService("MarketplaceService")
local button = script.Parent
local player = game.Players.LocalPlayer

button.MouseButton1Click:Connect(function()
    MarketplaceService:PromptPurchase(player, (10663110))
end)

4 comments

0

if it says the item is not for sale, its probably a private gamepass or an invalid gamepass id

0

The game pass is for sale. However, the game is not public. Could that be the problem?

0

i think that might be the problem

0

Okay, I'll see.

1 answer

✓ Accepted answer

Here you used "PromptPurchase." I suggest you use MarketplaceService:PromptGamepassPurchase I have given you the new script for your problem. Please use the added link to learn what I did.

local MarketplaceService = game:GetService("MarketplaceService")
local button = script.Parent
local player = game.Players.LocalPlayer

ID = 10663110
button.MouseButton1Down:Connect(function()
    MarketplaceService:PromptGamePassPurchase(player, ID)
end)

Resources: https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/PromptGamePassPurchase

https://developer.roblox.com/en-us/api-reference/class/MarketplaceService

1 comment

0

Well done <3

This discussion is preserved as it was. New answers, comments, and votes are closed.