T-Shirt Purchase Prompt

How would I script a part that when you click it, it prompts you to buy a t-shirt? I tried to do this with a regular shirt script but is has not worked.

Thanks,

3 Likes

Have you allowed third party sales? If not then that explains the shirt not prompting.

Also, can you show me the script?

2 Likes

Note: script.Parent is a click detector.

local MarketplaceService = game:GetService("MarketplaceService")
local ID = 

script.Parent.MouseClick:Connect(function(Player)
    MarketplaceService:PromptPurchase(Player, ID)
end)
2 Likes

This may sound dumb, but I just want to confirm that you did it, you did specify what ID is when you ran the script right?

2 Likes
local Game = game
local Workspace = workspace
local MarketplaceService = Game:GetService("MarketplaceService")
local Part = Workspace.Part --Reference to part that contains a click detector.
local ClickDetector = Part.ClickDetector --Reference to click detector.

local ClothingId = 0 --Change this to the T-Shirt's asset ID.

local function OnMouseClick(Player)
	local Success, Result = pcall(function() return MarketplaceService:PromptPurchase(Player, ClothingId) end)
	if not Success then warn(Result) end
end

ClickDetector.MouseClick:Connect(OnMouseClick)
1 Like

Alrighty, so enable 3rd party sales even if I’m selling my own t-shirt?

Thank you! My script was a lot smaller.

Thank you! I appreciate your help!

I don’t follow? The ID of the asset?

Well, if it’s a group game then yes you must.

The ID of the asset you’re selling clearly goes after ID =
You also don’t need 3rd party sales to sells your own items.
I may be wrong about that but I don’t set that on the things I sell in game.
However, I’ve never tried to sell a t-shirt so …