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

Prompt Gamepass Purchase on Click?

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!

3 comments

0

Can you post the script you tried?

0

Yes. The problem was with the ID - it's not a gamepass id.

1 answer

✓ Accepted answer

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.

1 comment

0

Thank you!

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