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)
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.
local shirtID = 7443130737
script.Parent.ClickDetector.MouseClick:Connect(function(playerWhoClicked)
local Player = game.Players:GetPlayerFromCharacter(playerWhoClicked)
game:GetService("MarketplaceService"):PromptPurchase(Player.UserId, shirtID)
end)
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:
Result:
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)