Clothing Purchase Script Not Working

Hello,

I have created this script below for clothing purchases, and it is not working. Does anyone know why this would be?
(I have enabled Allow Third Party Sales for the game)

local shirtID = 7443130737

script.Parent.ClickDetector.MouseClick:Connect(function(player)
	game:GetService("MarketplaceService"):PromptPurchase(player, shirtID)
end)
1 Like

Where is your problem emerging, exactly? When you click the ClickDetector, is the prompt even showing up? Or is the prompt showing up and you just aren’t able to purchase the item? Those are two separate issues that require clarification.

In addition to what xendatro said above, is the script a normal script or local script. Because if Local, and this is located in the workspace, it will not run.

1 Like
  1. It is a normal Script.

  2. The script runs but when MartketPlace UI is activated, it shows this:

local shirtID = 7443130737

script.Parent.ClickDetector.MouseClick:Connect(function(playerWhoClicked)
    local Player = game.Players:GetPlayerFromCharacter(playerWhoClicked)
    game:GetService("MarketplaceService"):PromptPurchase(Player.UserId, shirtID)
end)

Let me know with any problems you come across!

This did not work unfortunately…

Add this to the script and tell me wt prints:

local success, err = pcall(MarketplaceService.GetProductInfo, MarketplaceService, assetID)

if success then
    print(sucess)
else
    print(err)
local mps = game:GetService("MarketplaceService")
local part = script.Parent
local clickDetector = part:WaitForChild("ClickDetector")
local shirtId = 7443130737

clickDetector.MouseClick:Connect(function(player)
	mps:PromptPurchase(player, shirtId)
end)

Organisation:
image

Result:
image

You may need to enable 3rd party purchases in settings.

and here’s the place file if you’d like to take a look.
example.rbxl (26.7 KB)