I am making a product purchase in my game, but it is not doing anything. I had the same script in one of my previous games and that one worked, but when I moved it to my new game it didn’t work.
script
local MPS = game:GetService("MarketplaceService")
local ProductID = 1232153358
local Players = game:GetService("Players")
local function Receipt(ReceiptInfo)
local BoughtProductId = ReceiptInfo.ProductId
local Purchaser = Players:GetPlayerByUserId(ReceiptInfo.PlayerId)
if not Purchaser then
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local player= Purchaser
if Purchaser and BoughtProductId == ProductID then
player.backpack.Value= game.ReplicatedStorage._backpack.MoonBack
local read = CFrame.new(player.Character.UpperTorso.CFrame.Position)
player.Character.Humanoid:TakeDamage(999)
wait(0.50)
player.Character.UpperTorso.CFrame = read
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
MPS.ProcessReceipt = Receipt
Any help is greatly appreciated!!!
Have a happy new year!
Add a few prints and see what isn’t happening, or if it’s hanging somewhere for some reason. Try this and let me know the output:
print('ProcessReceipt')
local BoughtProductId = ReceiptInfo.ProductId
local Purchaser = Players:GetPlayerByUserId(ReceiptInfo.PlayerId)
if not Purchaser then
print('No purchaser')
return Enum.ProductPurchaseDecision.NotProcessedYet
end
local player= Purchaser
if Purchaser and BoughtProductId == ProductID then
print('Giving product')
player.backpack.Value= game.ReplicatedStorage._backpack.MoonBack
local read = CFrame.new(player.Character.UpperTorso.CFrame.Position)
player.Character.Humanoid:TakeDamage(999)
wait(0.50)
player.Character.UpperTorso.CFrame = read
end
print('OK')
return Enum.ProductPurchaseDecision.PurchaseGranted