Did I put the PurchaseGranted - line in the correct place in this script?
I am generally new to developer products, that is why I wnat to know if I put the PurchaseGranted - line in the correct place.
local plr = script.Parent.Parent.Parent.Parent.Parent
local link = game:GetService("MarketplaceService")
deb = 0
script.Parent.MouseButton1Click:connect(function()
local marketId = 43143148 --ID OF YOUR DEVELOPER PRODUCT
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
if deb == 0 then
deb = 1
plr.leaderstats.Snowflakes.Value = plr.leaderstats.Snowflakes.Value + 5000 --Alter what stat you would like to increase or decrease after the player has purchased.
wait(1)
deb = 0
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
end)

2 comments
You really should have two separate scripts for this. https://scriptinghelpers.org/questions/27112/how-do-i-use-dev-products#30658
Also, with this script reproducing itself to every player's PlayerGui, the ProcessReceipt may only be picked up by one callback function. So one player's script may pick up on your transaction and can't do anything about it.