Place: Ultimate Boxing - Roblox
As much as my code is in functions elsewhere, the function names hopefully should be clear.
[code]
local NotProcessedYet = Enum.ProductPurchaseDecision.NotProcessedYet
local PurchaseGranted = Enum.ProductPurchaseDecision.PurchaseGranted
function MarketplaceService.ProcessReceipt(Reciept)
local PlayerId,PurchaseId,ProductId,CurrencySpent = Reciept.PlayerId,Reciept.PurchaseId,Reciept.ProductId,Reciept.CurrencySpent
if not PlayerId or not PurchaseId or not ProductId or not CurrencySpent then
warn(“PURCHASE FAILED - MISSING INFO”)
return NotProcessedYet
end
local Player = game.Players:GetPlayerByUserId(PlayerId)
if not Player then
warn("PURCHASE OF "..tostring(ProductId).." FAILED - PLAYER NOT IN SERVER")
return NotProcessedYet
end
local function AlertPlayerOfCompletion(Message)
PurchaseCompleted:FireClient(Player,Message)
end
local function AnimateCoins(Amount)
AnimateCoinsEvent:FireClient(Player,Amount)
end
if FastFlagService:GetFastFlag("ProcessProductPurchases") ~= true then
warn("PURCHASE FAILED - PROCESSING DISABLED")
AlertPlayerOfCompletion("Your purchase failed because purchase processing is disabled. Your Robux will be refunded in 3 days if it isn't processed.")
return NotProcessedYet
end
PlayerDataService:AddProductPurchase(Player,ProductId,CurrencySpent)
local ProductName = IdToRobuxProduct(ProductId)
AddProductToTrackingByName(ProductName)
if ProductName == "DiamondBox" then
if InventoryManagerService:AwardItem(Player,1,61) then
AlertPlayerOfCompletion("Your purchase of a Diamond Box was successful! You now equip it in the inventory.")
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of a Diamond Box failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "NeonBox" then
if InventoryManagerService:AwardItem(Player,1,62) then
AlertPlayerOfCompletion("Your purchase of a Neon Box was successful! You now equip it in the inventory.")
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of a Neon Box failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "Coins50" then
if ShopManagerService:AwardCoins(Player,50) then
AlertPlayerOfCompletion("Your purchase of 50 coins was successful!")
PlayerDataService:SavePlayer(Player)
AnimateCoins(5)
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of 50 coins failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "Coins250" then
if ShopManagerService:AwardCoins(Player,250) then
AlertPlayerOfCompletion("Your purchase of 250 coins was successful!")
PlayerDataService:SavePlayer(Player)
AnimateCoins(10)
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of 250 coins failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "Coins1000" or ProductName == "Coins1000Discount" then
if ShopManagerService:AwardCoins(Player,1000) then
AlertPlayerOfCompletion("Your purchase of 1,000 coins was successful!")
PlayerDataService:SavePlayer(Player)
AnimateCoins(15)
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of 1,000 coins failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "Coins2500" then
if ShopManagerService:AwardCoins(Player,2500) then
AlertPlayerOfCompletion("Your purchase of 2,500 coins was successful!")
PlayerDataService:SavePlayer(Player)
AnimateCoins(20)
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of 2,500 coins failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "Coins5000" then
if ShopManagerService:AwardCoins(Player,5000) then
AlertPlayerOfCompletion("Your purchase of 5,000 coins was successful!")
PlayerDataService:SavePlayer(Player)
AnimateCoins(25)
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of 5,000 coins failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "WoodCrate" then
if InventoryManagerService:AwardItem(Player,3,1) then
AlertPlayerOfCompletion("Your purchase of a Wood Crate was successful! You now open it in the inventory.")
PlayerDataService:SavePlayer(Player)
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of a Wood Crate failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "MetalCrate" then
if InventoryManagerService:AwardItem(Player,3,2) then
AlertPlayerOfCompletion("Your purchase of a Metal Crate was successful! You now open it in the inventory.")
PlayerDataService:SavePlayer(Player)
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of a Metal Crate failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "GoldCrate" then
if InventoryManagerService:AwardItem(Player,3,3) then
AlertPlayerOfCompletion("Your purchase of a Gold Crate was successful! You now open it in the inventory.")
PlayerDataService:SavePlayer(Player)
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of a Gold Crate failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
elseif ProductName == "NeonCrate" then
if InventoryManagerService:AwardItem(Player,3,4) then
AlertPlayerOfCompletion("Your purchase of a Neon Crate was successful! You now open it in the inventory.")
PlayerDataService:SavePlayer(Player)
return PurchaseGranted
else
AlertPlayerOfCompletion("Your purchase of a Neon Crate failed. Your Robux will be refunded in 3 days if it isn't processed.")
end
end
AlertPlayerOfCompletion("Your purchase failed because purchase of an internal server error. Your Robux will be refunded in 3 days if it isn't processed.")
return NotProcessedYet
end[/code]
The person mentioned never getting a response, so I am thinking it failed early or never started.