I keep getting an error saying "attempt to index nil with ‘PlayerId’
does anyone have this issue or know how to fix this?
local MarketplaceService = game:GetService("MarketplaceService")
local function processReceipt(receiptInfo)
local player = game:GetService("Players"):GetPlayerByUserId(receiptInfo.PlayerId)
if not player then
-- player does not exist/ left game
return Enum.ProductPurchaseDecision.NotProcessedYet
end
-- script below controls what happens if bought
print(player.Name.." just bought ".. receiptInfo.PreoductId)
player.leaderstats.Points.Value = player.leaderstats.Points.Value + 100
return Enum.ProductPurchaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = processReceipt()