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

Purchase adds to others stat, Can some help fix?

Asked by
Seenit 80
10 years ago
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!

1 answer

Log in to vote
0
Answered by
Tixy12 0
10 years ago

Here take this script and edit it. I made it simple with notes so you would know what to do. :) If this helps you help Thumbs it up and say it gave you a answer!

http://www.roblox.com/Dev-Product-Stats-item?id=166267560

Just copy and paste then take it.

Ad

Answer this question