Nothing happens when I buy a Developer Product

I made a script to handle all developer product purchases but every time when I purchase something nothing happens and no errors show up
I looked at other Topics but none of them really helped

This is the code

MarketPlaceService.ProcessReceipt = function(Receipt)
	
local Players = game:GetService("Players")	
	
local Player = Players:GetPlayerByUserId(Receipt.PlayerId)	
	
local leaderstats = Player:WaitForChild("leaderstats")	
	
local Wins = leaderstats:WaitForChild("Wins")	
	
local Height = leaderstats:WaitForChild("Max Height")	
	
local DoubleHeightFolder = Player:WaitForChild("DoubleHeightFolder")	
	
local DoubleAmountHeight = DoubleHeightFolder:WaitForChild("DoubleAmount")
	
local DoubleWinsFolder = Player:WaitForChild("DoubleWinsFolder")	
	
local DoubleAmountWins = DoubleWinsFolder:WaitForChild("DoubleAmount")	
	
----------------------------------------------------------------------------------------	
	
if not Player then
		
print("Player has left the Server")		
		
return Enum.ProductPurchaseDecision.NotProcessedYet				
		
elseif Receipt.ProductId == TenWins then		
		
Wins.Value = Wins.Value + 10		
		
print("Player Bought 10 Wins!")		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == TwentyWins then		
		
Wins.Value = Wins.Value + 25		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == FiftyWins then		
		
Wins.Value = Wins.Value + 50		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == HundredWins then		
		
Wins.Value = Wins.Value + 100		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == TwoHundredAndFiftyWins then		
		
Wins.Value = Wins.Value + 250 		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == FiveHundredWins then		
		
Wins.Value = Wins.Value + 500		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == ThousandWins then		
		
Wins.Value = Wins.Value + 1000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId ==	FirstHeight then	
		
Height.Value = Height.Value + 250
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == FiveHundredHeight then		
		
Height.Value = Height.Value + 500	
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == SevenHundredHeight then	
		
Height.Value = Height.Value + 750 				
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == ThousandHeight then		
		
Height.Value = Height.Value + 1000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == TwoThousandHeight then		
		
Height.Value = Height.Value + 2000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == FivethousandHeight then		
		
Height.Value = Height.Value + 5000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == tenThousandHeight then		
		
Height.Value = Height.Value + 10000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == x2Win then		
		
DoubleAmountWins.Value = DoubleAmountWins.Value + 2		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == x4Win then		
		
DoubleAmountWins.Value = DoubleAmountWins.Value + 4		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == x2Height then		
		
DoubleAmountHeight.Value = DoubleAmountHeight.Value + 2		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == x4Height then		
		
DoubleAmountHeight.Value = DoubleAmountHeight.Value + 4		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == NukeId then		
		
game:GetService("ReplicatedStorage"):WaitForChild("NukeMyBoy"):FireAllClients(Receipt.PlayerId)		
		
wait(4)		
		
game:GetService("ServerStorage"):WaitForChild("Nuke"):Fire()		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == CandyTower then		
		
Wins.Value = 1

return Enum.ProductPurchaseDecision.PurchaseGranted			
		
elseif Receipt.ProductId == LavaTower then		
		
Wins.Value = 3

return Enum.ProductPurchaseDecision.PurchaseGranted			
		
elseif Receipt.ProductId == DesertTower then		
		
Wins.Value = 4

return Enum.ProductPurchaseDecision.PurchaseGranted			
		
elseif Receipt.ProductId == SnowTower then		
		
Wins.Value = 5		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == AquaTower then		
		
Wins.Value = 6		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == GoldenTower then		
		
Wins.Value = 20		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == CoalTower then		
		
Wins.Value = 25		
		
return Enum.ProductPurchaseDecision.PurchaseGranted				
		
end		
		
end	
	
2 Likes

Have you tried putting a print() inside the ProcessReceipt callback function? Does it run in the first place?

Ok so,

  1. Where is your code located?
  2. Is the code you sent the only thing in the script? Possibly other code could be stopping it running
  3. What type of script are you using?

Just added it now and it’s not showing up in the output so I dont think if it even runs
It worked perfectly fine yesterday but not today

its located in ServerScriptService, I’m using a sever Script and here is the full code

local MarketPlaceService = game:GetService("MarketplaceService")

local TenWins = 1365178398	-- WinsId
local TwentyWins = 1365178502
local FiftyWins = 1365178662
local HundredWins = 1365178742
local TwoHundredAndFiftyWins = 1365178874
local FiveHundredWins = 1365178996
local ThousandWins = 1365179136

local NukeId = 1365178135 -- Nuke

local FirstHeight = 1365179323
local FiveHundredHeight = 1365179395
local SevenHundredHeight = 1365179455 
local ThousandHeight = 1365179536
local TwoThousandHeight = 1365179672
local FivethousandHeight = 1365754726
local tenThousandHeight = 1365179807

local x2Height = 1365179982
local x4Height = 1365180021
local x2Win = 1365179894
local x4Win = 1365179930

local CandyTower = 1365185802
local LavaTower = 1365186123
local DesertTower = 1365186288
local SnowTower = 1365186418
local AquaTower = 1365186515
local GoldenTower = 1365186665
local CoalTower = 1365186849

--------------------------------------------------------------------------------------------------	

MarketPlaceService.ProcessReceipt = function(Receipt)
	
print("Working?")	
	
local Players = game:GetService("Players")	
	
local Player = Players:GetPlayerByUserId(Receipt.PlayerId)	
	
local leaderstats = Player:WaitForChild("leaderstats")	
	
local Wins = leaderstats:WaitForChild("Wins")	
	
local Height = leaderstats:WaitForChild("Max Height")	
	
local DoubleHeightFolder = Player:WaitForChild("DoubleHeightFolder")	
	
local DoubleAmountHeight = DoubleHeightFolder:WaitForChild("DoubleAmount")
	
local DoubleWinsFolder = Player:WaitForChild("DoubleWinsFolder")	
	
local DoubleAmountWins = DoubleWinsFolder:WaitForChild("DoubleAmount")	
	
----------------------------------------------------------------------------------------	
	
if not Player then
		
print("Player has left the Server")		
		
return Enum.ProductPurchaseDecision.NotProcessedYet				
		
elseif Receipt.ProductId == TenWins then		
		
Wins.Value = Wins.Value + 10		
		
print("Player Bought 10 Wins!")		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == TwentyWins then		
		
Wins.Value = Wins.Value + 25		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == FiftyWins then		
		
Wins.Value = Wins.Value + 50		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == HundredWins then		
		
Wins.Value = Wins.Value + 100		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == TwoHundredAndFiftyWins then		
		
Wins.Value = Wins.Value + 250 		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == FiveHundredWins then		
		
Wins.Value = Wins.Value + 500		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == ThousandWins then		
		
Wins.Value = Wins.Value + 1000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId ==	FirstHeight then	
		
Height.Value = Height.Value + 250
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == FiveHundredHeight then		
		
Height.Value = Height.Value + 500	
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == SevenHundredHeight then	
		
Height.Value = Height.Value + 750 				
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == ThousandHeight then		
		
Height.Value = Height.Value + 1000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == TwoThousandHeight then		
		
Height.Value = Height.Value + 2000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == FivethousandHeight then		
		
Height.Value = Height.Value + 5000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == tenThousandHeight then		
		
Height.Value = Height.Value + 10000		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == x2Win then		
		
DoubleAmountWins.Value = DoubleAmountWins.Value + 2		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == x4Win then		
		
DoubleAmountWins.Value = DoubleAmountWins.Value + 4		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == x2Height then		
		
DoubleAmountHeight.Value = DoubleAmountHeight.Value + 2		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == x4Height then		
		
DoubleAmountHeight.Value = DoubleAmountHeight.Value + 4		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == NukeId then		
		
game:GetService("ReplicatedStorage"):WaitForChild("NukeMyBoy"):FireAllClients(Receipt.PlayerId)		
		
wait(4)		
		
game:GetService("ServerStorage"):WaitForChild("Nuke"):Fire()		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == CandyTower then		
		
Wins.Value = 1

return Enum.ProductPurchaseDecision.PurchaseGranted			
		
elseif Receipt.ProductId == LavaTower then		
		
Wins.Value = 3

return Enum.ProductPurchaseDecision.PurchaseGranted			
		
elseif Receipt.ProductId == DesertTower then		
		
Wins.Value = 4

return Enum.ProductPurchaseDecision.PurchaseGranted			
		
elseif Receipt.ProductId == SnowTower then		
		
Wins.Value = 5		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == AquaTower then		
		
Wins.Value = 6		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == GoldenTower then		
		
Wins.Value = 20		
		
return Enum.ProductPurchaseDecision.PurchaseGranted		
		
elseif Receipt.ProductId == CoalTower then		
		
Wins.Value = 25		
		
return Enum.ProductPurchaseDecision.PurchaseGranted				
		
end		
		
end