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