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?
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 :)