I was reading off the wiki about dev products because it was my first time using them, but every time I use my function in my server script and print the ID of the product it prints is nil.
Any help?
Client:
local MPS = game:GetService("MarketplaceService")
-- // Dev Products
script.Parent.Product1.TextButton.MouseButton1Click:Connect(function()
local ProdID = 314544711
MPS:PromptProductPurchase(Player, ProdID)
end)
Server:
local MPS = game:GetService("MarketplaceService")
function MPS.ProcessReceipt(receiptInfo)
print(receiptInfo.ProdID) -- // Where it prints nil
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Double-check you’re spelling it correctly. Here’s all the keys that should exist in the receiptInfo. I’ve never had it print nil before. Notice the “d” in “Id” is lowercase.
Also, you can double-check by listing all contents of receiptInfo:
print("ReceiptInfo:")
for k,v in pairs(receiptInfo) do print(k,v) end
When you access a table using a key, it will always return the value. If you’re new to tables, I would recommend looking at some tutorials for them. They can be a tricky concept to pick up.