Clothing prompt purchase not working

When I try prompting a clothing item purchase (from Avatar Shop), it says “This item is not currently for sale”. image

local man = script.Parent

local shirt = man:FindFirstChild("Shirt")
local pants = man:FindFirstChild("Pants")

local top = man:FindFirstChild("ShirtT")
local bottom = man:FindFirstChild("PantsT")

local topT = top:FindFirstChild("ClickDetector")
local bottomT = bottom:FindFirstChild("ClickDetector")

local shirtID = string.sub(shirt.ShirtTemplate, 33)
local pantsID = string.sub(pants.PantsTemplate, 33)

	game:GetService("MarketplaceService"):PromptPurchase(player, pantsID)

	game:GetService("MarketplaceService"):PromptPurchase(player, shirtID)

Try converting the string from the shirtID and pantsID variables to a number.

Thanks for your reply, but unfortunately converting it to a number didn’t make a difference.

Strange. Let me read through the MarketPlaceService documentation and see what’s up.

Are you sure that string.sub(pants.PantsTemplate, 33) is returning a valid asset ID?

Yes I am, I made it print the value and it’s the same ID.

Are you sure that both of the items actually on sale?

Most definitely, I took them right off the Avatar Shop. I’ve tried other IDs as well.

This is because when you input an ID of any clothing asset into the ShirtTemplate/PantTemplate it sets the value to it’s AssetId, this is different from the catalog id which would be used to prompt purchases.

Image from Gyazo

Image from Gyazo


I wasn’t entirely sure whether that was the case or not after reading the API reference for PromptPurchase, since I hadn’t tested it yet.

Thank you for clarifying, now I can continue developing :sweat_smile:

1 Like

Hello, i found that when i copy and paste shirt ID from catalog and paste it to shirt template
It still doesnt work

You should not run :PromptPurchase() with the ShirtTemplate as the assetId.