Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make it where, when a user clicks on the image, then they able to buy the clothing?

Asked by 7 years ago

https://gyazo.com/013be0156065545c7b1275b0aeb77edc?token=cd72a0b72fb5deac53648107e9f978ae

https://gyazo.com/3e2f5bcf95255c81b5b7140dfb89bed4

local shirtId = 1361887013

script.Parent.ClickDetector.MouseClick:connect(function(player)
    Game:GetService("MarketplaceService"):PromptPurchase(player, shirtId)
end)
local pantsId = 1361888033

script.Parent.ClickDetector.MouseClick:connect(function(player)
    Game:GetService("MarketplaceService"):PromptPurchase(player, pantsId)
end)

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

If you are using a gui you have to use something like this (it has to be an image button!) and it has to be a localscript inside the button

button = script.Parent
local pantsId = 1361888033

button.MouseButton1Click:connect(function()
    Game:GetService("MarketplaceService"):PromptPurchase(player, pantsId)
end)
0
I only showed the detection code, things like marketservice you have to do yourself, I'll edit the script though User#20388 0 — 7y
Ad

Answer this question