I am making a game for my clothing group, and when a user clicks a shirt, it would ask them if they wanted to buy the shirt. Here is my code:
script.Parent.ClickDetector.MouseClick:connect(function(plr) -- How do I ask the player if they want to buy the shirt? end)
It's actually really easy, there is a service called MarketplaceService that you can use to achieve what you want.
There is a function of MarketplaceService that is called PromptPurchase which is what you can use to allow the player to buy any asset.
The first two parameters that PromptPurchase takes is the player object, and the second is the asset Id (Id of the asset on the roblox website, ex: https://www.roblox.com/catalog/139610216/Korblox-Deathspeaker, the id of this would be "139610216").
So lets translate this into code:
local marketplaceService = game:GetService("MarketplaceService") script.Parent.ClickDetector.MouseClick:connect(function(plr) marketplaceService:PromptPurchase(plr, 1234) -- replace 1234 with the id of asset end)
Hope this helped! :)