How to sell hairs + hats in-game?

I’m currently building a Clothing Store, and I think It’ll be a nice touch if I added the ability to purchase hairs and hats in game. I’ve seen one of my allies coded clothing do this, how would I implement this feature? Please note that I’m not a programmer, but I know how to script UIs.

maybe use third party selling and sorry if im wrong

Use MarketplaceService.
DevHub MarketPlaceService

I think it would be


I don’t have any coding experience, I-

Do not worry, I found this on the devhub and it is quite useful,

game:GetService(“MarketplaceService”):PromptPurchase(game.Players.LocalPlayer, 4367427794)

Replace the numbers at the end with the ID of the product, it may be time consuming sometimes but all you have to do is go to the desired product on the roblox website,
(Please only do it on the google website and not on the app) and click the link on the top bar and finnaly find the numbers near the end, copy and paste that to the current numbers above! “4367427794”, but wait, something is wrong, it only does it randomly and not when you click it, oh no, PANIK? no NO PANIK, now listen carefully as this is vital,

Go to the button you want the player to click, then add a clickdetector,

if you don’t know what this does, it makes it so when a player presses/taps/clicks the button, something can happen, the correct term used by developers is “an event fires

Then add a script to the click detector, now there are a few different types of scripts so what I’m about to ask you to do is add a “script”, then double tap that script, which means open it, and remove the


Now let’s begin the script, here is my recreation, kind of,

local THEID = 4367427794 — replace this with the ID (google website as I said above)
game:GetService(“MarketplaceService”):PromptPurchase(game.Players.LocalPlayer, THEID)

I hope this helps,

Sincerely, @oscoolerreborn


Will safari work, instead of google?

Your part must be in the workspace but the script does not go into the part, you can if you want to but then I would rewrite the script, anyways, put a click detector in the part, here is an image:
From there, add a script to the ClickDetector, sadly no image on google represents a specific thing all the time so I cannot show image right now, sorry, but anyways just add a script to the clickdetector, with the + button when you hover over it inside the workspace! :wink:

1 Like

1 Like

Am I doing this right?

1 Like

Let me try breaking down the script for you AND me so I can figure out the problem,
The error does not include the so called “event that fired” so we can remove that,

local THEID = 4367427794

game:GetService(“MarketplaceService”):PromptPurchase(game.Players.LocalPlayer, THEID)

And also the variable, which is after the word “local”so let’s remove that ,sorry that I cannot explain what everything means in detail :frowning:,

game:GetService(“MarketplaceService”):PromptPurchase(game.Players.LocalPlayer, THEID)

Just in case, please try writing out the script instead of copying and pasting since I can’t do tabs well, I forgot the name :confused: but a tab is something like this

—WOAH WHATS THIS, oh a tab, :slight_smile:
Hello again, no wait bye

On a computer, just press tab and an… INDENTATION WILL APPEAR, indentation is the word,

Also, please press the error if you can since it shows me exactly where in the script it is talking about :happy2:

1 Like

Something seems wrong, sorry for the confusion, remove the entire first line, and leave the others :sad: ,

now they will be sad you didn’t take them aswell (jk)

and something seems wrong with the 5th line, you seem to have forgotten the capital “P” in MarketPlaceService, I’ll try to chat less since it may seem like spam! I hope this helps,

1 Like

No, no it’s fine. You’re helping me! :grin:

1 Like

I don’t see any Syntax Errors, would this work?

Where it says “THEID” do I replace it with the product id?

I’m not too sure 192 is the correct ID, let me try give you an example,
Here is the link to the ID https:// catalog/ 22877700/ Whistle

And the number is
As you can see on the link itself :happy1:
But in other words, yes, it should works just fine! :happy4:
Here the devhub link

The id 192 is the Korblox Deathpseaker id, I used this id: 25166274
I’m not getting the purchase pop-up.
By the way here is the game: Coded Clothing Mall V2 🛍️ - Roblox. Maybe if you join and see how they do the purchase?

1 Like

Is there an error? I’m going to try my script on my own, I’ll try to help the best I can, by the way, you won’t get the same gui like the game since we need to script it, sorry, hmmm please give me a moment to test it :happy1: :roblox:

1 Like

Oh, I don’t really need the UI, I just wanted people to purchase hairs, hats or faces. But if there is a UI thats amazing!

1 Like

try to tick the “allow third party sales” in your game settings to see if the prompt appears

1 Like

Try this

local AssetID = 000000 -- Replace this with the Asset ID
local MarketplaceService = game:GetService("MarketplaceService")
-- Input type here, I'm going to be using a click detector
print(Click.Name.." clicked the button!")
MarketplaceService:PromptPurchase(Click, AssetID)
print("Prompted Player!")

This is a server script, btw.


local THEID = 494290547
local MarketPLACEsERVICE = game:GetService(“MarketplaceService”)
MarketPLACEsERVICE:PromptPurchase(player, THEID)

i got so many things wrong :sad: sorry, you need to change to MouseClick, function(player) and more :sob:

i hope it helps… again :happy2:

1 Like