I have an error while trying to get the player/UserID when a dev product is purchased, here is my script:
local productID = 1270692852
local MPS = game:GetService('MarketplaceService')
local function processRecipet(RecieptInfo)
local plr = game.Players:GetPlayerByUserId(RecieptInfo.PlayerId)
if not plr then
-- plr probably left.
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if RecieptInfo.PurchaseId == productID then
if plr then
local leaderstats = plr:WaitForChild('leaderstats')
local Gems = leaderstats:WaitForChild('Gems')
Gems.Value = Gems.Value + 50
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
-- call back
MPS.ProcessReceipt = processRecipet()
The error is on this line:
local plr = game.Players:GetPlayerByUserId(RecieptInfo.PlayerId)
All of this is in a server script.

1 comment
The only problem now is that it isn't giving me the stuff, which I'll just make a new question for.