Ingame Purchase Script prompting the wrong item to purchase

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!
    Have it so when the “Purchase” button in my game is pressed, it asks to buy the correct item.
  2. What is the issue? Include screenshots / videos if possible!
    Currently, when I press “Purchase” in game, it asks to buy something completely different, and the one gamepass (Glock-17 forever) says it’s not on sale when it is.

    https://gyazo.com/6d128af6bbcbf42d08491bc5de182643
    robloxapp-20200519-1327254.wmv (958.6 KB) < Video of it not working.
    Here’s the script:
    (I know! I need to get out of the habit of using a million .Parent.Parent’s, lol)
	script.Parent.Parent.Parent.Parent.Parent.SoundEffects.ClickSound:Play()
end)

script.Parent.MouseEnter:Connect(function()
	script.Parent.Parent.Parent.Parent.Parent.SoundEffects.HoverSound:Play()
end)

local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
 
local productID = 9508134
 
local function promptPurchase()
	local player = Players.LocalPlayer
	MarketplaceService:PromptProductPurchase(player, productID)
end

script.Parent.MouseButton1Click:Connect(promptPurchase)

And here’s the gamepass I’m trying to use with it.

The linked gamepass is the one that say that the pass isn’t on sale, when it is.
The other ones use the same script but display random items such as “Super Cool Baseplate” and “Microwave”

1 Like

Instead of using:
MarketplaceService:PromptProductPurchase(player, productID)

Try to use:
MarketplaceService:PromptGamePassPurchase(player,productID)

1 Like

You need to prompt a GamePassPurchase.

In order to do this, use:
MarketplaceService:PromptGamePassPurchase(player,productID)

You are currently using ProductPurchase, which prompts for a t-shirt, gear, devproduct, model or items of a similar nature.

(Marking this as a solution is appreciated as it helps other people with the same question.)

1 Like

Thank you! It worked. 30characters