Gamepass prompt gives error "Your purchase failed because something went wrong."

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a gamepass prompt in a script (LocalScript to be more specific) so when a player clicks on a button a product prompt will pop up using the MarketplaceService

  2. What is the issue? Include screenshots / videos if possible!
    image
    I want this to disappear and I want the actual prompt to pop up

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I’ve tried a lot of solutions I found online but none of them worked. Id is correct, third party sales are on and I do not own the gamepass yet. Code I use is provided below

local MarketplaceService = game:GetService("MarketplaceService")

local ImageId = script.Parent.ImageId
local Price = script.Parent.Price
script.Parent.Frame.TextButton.Text = Price.Value.."R$"
script.Parent.Frame.Frame.ImageLabel.Image = "rbxassetid://"..ImageId.Value
script.Parent:FindFirstChild("Frame").TextButton.Activated:Connect(function(InputObject, ClickCount)
	MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer, script.Parent.GamepassId.Value)
end)

Hope anyone can help me.

MarketplaceService:PromptProductPurchase is for product purchases only, you need to use MarketplaceService:PromptGamePassPurchase for gamepasses

so instead of this:

script.Parent:FindFirstChild("Frame").TextButton.Activated:Connect(function(InputObject, ClickCount)
	MarketplaceService:PromptProductPurchase(game.Players.LocalPlayer, script.Parent.GamepassId.Value)
end)

do this:

script.Parent:FindFirstChild("Frame").TextButton.Activated:Connect(function(InputObject, ClickCount)
	MarketplaceService:PromptGamePassPurchase(game.Players.LocalPlayer, script.Parent.GamepassId.Value)
end)
5 Likes

Tysm that worked! How did I not think of that :sob:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.