Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make a text button prompt a gamepass?

Asked by 3 years ago

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)
0
if it says the item is not for sale, its probably a private gamepass or an invalid gamepass id NeonPandaEyes331 21 — 3y
0
The game pass is for sale. However, the game is not public. Could that be the problem? SecretPax 20 — 3y
0
i think that might be the problem NeonPandaEyes331 21 — 3y
0
Okay, I'll see. SecretPax 20 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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

0
Well done <3 SecretPax 20 — 3y
Ad

Answer this question