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

Prompt Gamepass Purchase on Click? [closed]

Asked by
ghaybe 5
6 years ago

Hi all, I've been having some trouble with regards to the above problem. In-game, there will be a sign with the gamepass. I'm having trouble with scripting something that will prompt the purchase of it. I appreciate any help!

0
Can you post the script you tried? Leamir 3138 — 6y
0
Yes. The problem was with the ID - it's not a gamepass id. ghaybe 5 — 6y

Closed as Not Constructive by climethestair and User#21908

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 6 years ago

Do something like this:

local part = script.Parent
local detector = part.ClickDetector

local function promptPurchase(player)
    local service = game:GetService("MarketplaceService")
    service:PromptGamePassPurchase(player, "Gamepass ID goes here in number format")
end

detector.MouseClick:Connect(promtPurchase)

This is a basic script which prompts the purchase of a gamepass when a part is clicked. I'm pretty sure you can modify this script to suit your needs.

0
Thank you! ghaybe 5 — 6y
Ad