Title.
I have no idea how to do this, HELP
Title.
I have no idea how to do this, HELP
local marketplaceService = game:GetService("MarketplaceService")
marketplaceService.ProcessReceipt = function(receiptInfo)
--.. user is purchasing a developer product
end
Could you detail this a little more? I’m a little confused.
Please help, I tried doing this on a local script, and it said “ProcessReceipt can be only handled on server” so I wrote this in ServerScriptService
:
local mS = game:GetService("MarketplaceService")
local plrs = game:GetService("Players")
local productID = 1578922289
mS.ProcessReceipt = function(receipt)
local plr = plrs:GetPlayerByUserId(receipt.PlayerId)
if not plr then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if receipt.productID == productID then
print("Thanks for supporting the game," .. plr.Name)
end
end
But it doesn’t work! HELP
You must confirm the operation with Enum.ProductPurchaseDecision.PurchaseGranted
. Example:
local mS = game:GetService("MarketplaceService")
local plrs = game:GetService("Players")
local productID = 1578922289
mS.ProcessReceipt = function(receipt)
local plr = plrs:GetPlayerByUserId(receipt.PlayerId)
if not plr then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if receipt.productID == productID then
print("Thanks for supporting the game," .. plr.Name)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
Don’t know why, the message did not print.
replace to ProductId
. Sorry, didn’t see it.
local mS = game:GetService("MarketplaceService")
local plrs = game:GetService("Players")
local productID = 1578922289
mS.ProcessReceipt = function(receipt)
local plr = plrs:GetPlayerByUserId(receipt.PlayerId)
if not plr then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
if receipt.ProductId == productID then
print("Thanks for supporting the game," .. plr.Name)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.