Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Purchase adds to others stat, Can some help fix?

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

This discussion is preserved as it was. New answers, comments, and votes are closed.