It also adds a point to my leaderboard when bought.
local Button = script.Parent
local ItemID = 5334371663 --ID number of shirt
local ClickDetector = Instance.new("ClickDetector", Button)
local MS = game:GetService("MarketplaceService")
local function PurchaseItem(Player)
local PurchaseCount = Player.leaderstats.PurchaseCount
MS:PromptPurchase(Player, ItemID)
for i in 0, 5 do
local Success, playerOwnsAsset = pcall(MS.PlayerOwnsAsset, MS, Player, ItemID)
if playerOwnsAsset then
PurchaseCount.Value = PurchaseCount.Value + 1
end
wait(5)
end
end
Click.MouseClick:Connect(PurchaseItem)

7 comments
You need to put the ITEM ID where it says MS:PromptPurchase(Player, ItemID) I think that should fix it!
ok ill try that, thanks
@spo0kd that wouldn't work
@spo0kd that wouldn't work
What are you trying to do? What didn't work? Please give some more information.
@raid6n This is entirely my fault. See: https://scriptinghelpers.org/questions/109151
Maybe it's because you already own the clothes -_-