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

Not able to prompt gamepass purchase?

Asked by 7 years ago
Edited 7 years ago

I set it up so that when you click a textbutton, it prompts you to buy a gamepass. Here's the code:

local plr = game.Players.LocalPlayer
local gpId = 1011985603
script.Parent.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptGamePassPurchase(plr, gpId)
end)

When the game is running and I click the button, instead of asking me to buy the gamepass, it says "Your purchase failed because something went wrong. Your account has not been charged. Please try again later." In the output it says "PurchasePromptScript: getProductInfo failed because MarketplaceService:getProductInfo() failed because HTTP 0 (HTTP 400 (HTTP/1.1 400 BadRequest)) Make sure a valid ID was specified"

This was done in a LocalScript inside the button. I tried this with various gamepass id's from very popular games and it still won't work. Any help?

0
The error is self explanatory. Check the ID to see if it has any typos. PyccknnXakep 1225 — 7y
0
USE A CODE BLOCK or we will not want to help you. Error means you are not passing the ID of a gamepass lukeb50 631 — 7y
0
I checked the ID and it was the same as in the URL DryChicken 0 — 7y
0
Humm... Just checked the ID and it seems to be valid. Im stumped lukeb50 631 — 7y
View all comments (2 more)
0
do PromptPurchase, maybe that will work R_alatch 394 — 7y
0
Not sure why, but that worked. Thank you so much! DryChicken 0 — 7y

2 answers

Log in to vote
0
Answered by 7 years ago

Use PromptPurchase instead of PromptGamePassPurchase

Ad
Log in to vote
0
Answered by 6 years ago

Hi, You should use :PromptPurchase() Instead Of :PromptGamePassPurchase()

I have a fixed script below:

local plr = game.Players.LocalPlayer
local gpId = 1011985603
script.Parent.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptPurchase(plr, gpId)
end)
-- Fixed By UltraAviation

I hope I helped :)

Answer this question