How can I buy clothes from the roblox avatar shop In-game

So basically I would like to know how to make a script that when you click a park it prompts you to buy a shirt from the Roblox avatar shop so it will be in their Roblox inventory. I know it is possible but Im not sure how to do it

1 Like

https://developer.roblox.com/en-us/api-reference/class/MarketplaceService

That’s not what I mean, I want when players buy the shirt it will be in there roblox inventory so basically if you go into the roblox website and go to their inventory they will see the shirt

It is what you mean so go and use it

Well its not really giving me what I need

Then goto the opticians and ask them for an eyetest because it literally has everything you need

https://developer.roblox.com/en-us/api-reference/function/MarketplaceService/PromptPurchase

I think this will work

1 Like

I mean its not really showing me how to buy stuff from the avatar shop from in-game

Do you know how an api works? Just asking because it literally has EVERYTHING YOU ENED AND YOU JSUT NEEDD TO CLICK ON THE THING YOUR TRYNA LOOK AT AND ITLL SHOW YOU WHAT TO DO

1 Like

Do you think Roblox is just gonna put up a messy page showing code for literally everything? Answer is no they won’t so you have to click on the thing your tryna learn to try and see how its used!

2 Likes

Look into this MarketplaceService | Roblox Creator Documentation

Place this script in the model containing the shirt

local shirtId = 6519691820

local function onClick(whoClicked)
	game:GetService("MarketplaceService"):PromptPurchase(whoClicked, shirtId)
end

for _, child in pairs(script.Parent:GetChildren()) do
	if child:IsA("Part") then
		local cd = Instance.new("ClickDetector")
		cd.MouseClick:Connect(onClick)
		cd.Parent = child
	end
end
2 Likes
local MPService = game:GetService("MarketplaceService")
local clickDetector = script.Parent
local pantsId = 23571257

clickDetector.MouseClick:Connect(function(player)
	MPService:PromptPurchase(player, pantsId)
end)

Here’s a more generic use script, just needs to be placed inside the “ClickDetector” instance itself.

1 Like