local buyButton = script.Parent
local productId = 20495307
local mps = game:GetService"MarketplaceService"
buyButton.MouseButton1Click:connect(function()
mps:PromptProductPurchase(script.Parent.Parent.Parent.Parent.Parent, productId)
print("Prompt Purchase")
end)
mps.ProcessReceipt = function(info)
local plr = script.Parent.Parent.Parent.Parent.Parent
if plr and plr:FindFirstChild"leaderstats" and plr.leaderstats:FindFirstChild"Coins" then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 1000
print(plr.Name.." got the purchase.")
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
It gives the purchase and coins but the coins go to a random player rather than the customer who paid for it. If you see an error, please correct me!
