Prompt Purchase not working in game

Hello Developers! I am currently scripting a home store for another developer, however, the prompt purchase doesn’t work and an error comes up (see attached). I have tried editing my script multiple times and nothing seems to be working.

The script I’m using is:

local shirtId = – my shirt id
script.Parent.ClickDetector.MouseClick:connect(function(player)
Game:GetService(”MarketplaceService”): PromptPurchase(player, shirtId)
end)

(p.s: I am writing this on mobile, so I am very sorry for any incorrect formatting or mistakes as I am also new to this) :slight_smile:

Are you positive that you have the right id, if so make sure it is on sale.

1 Like

Yes, the Shirt is on sale and I have the correct ID! (Thank you so much for replying (:smile:

I don’t think this will make a massive difference but try using
game:GetService(”MarketplaceService”): PromptPurchase(player, shirtId)
instead of
Game:GetService(”MarketplaceService”): PromptPurchase(player, shirtId)
Also could you pass me the Shirt Id?

1 Like

Hmm, still doesn’t seem to work. The shirt ID is: (5060147582)! Thank you. XD

That id links to the source image, you need to get the actual shirt id.
https://www.roblox.com/library/5060147582/split-hair-top is the id you provided
To get the shirt id you first go to the page where you buy the shirt on the ROBLOX website then
image
You take a look at the url and see the numbers. The numbers represent the id of the shirt.
By the seems of it the ShirtId is 5060147598

1 Like

When buying something with PromptPurchase there’s still more you need to do. The PromptPurchase brings up that Gui but after that you need to do

local MarketPlaceService = game:GetService("MarketPlaceService")

function GiveShirt(processReciept)
      --add the script to give the shirt and stuff make sure you return the purchase as granted
end

MarketPlaceService.ProductPurchaseDecision = GiveShirt

I myself am still new to MarketPlaceService so this may not be the problem and it’s probably what @Sartorra said.

More Info about processReciept

1 Like

I’m sorry, that took me so long to figure out! ^^ testing it. I understand what you’re saying.

1 Like

It worked, thanks so much for your time! I appreciate all your help! :))))) :heart:

1 Like

Thank you so much for your time! @Sartorra helped me fix it! :*))