The intention of this script is to check if a player has bought a developer product, however it's not working and I'm kinda stuck with this.

  • Works in Studio, however it doesn't work in the client.
  • Nothing is showing in the Developer Console.
  • Everything stops printing past the ProcessReceipt function.
-- [[ Service Storage ]] --

local Players = game:GetService("Players")
local MarketplaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetService("ServerStorage")

-- [[ Variable Storage ]] --

local IlluminaTool = ReplicatedStorage:FindFirstChild("PT_Tools"):FindFirstChild("Illumina")
local SniperTool = ReplicatedStorage:FindFirstChild("PT_Tools"):FindFirstChild("LeverAction")
local PlayerMoney = ReplicatedStorage:FindFirstChild("PlayerMoney")

-- [[ Code ]] --

MarketplaceService.ProcessReceipt = function(receiptInfo)
	for i, player in ipairs(game.Players:GetChildren()) do
		if player.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == 36986748 then
				print("test")
				PlayerMoney[player.Name].Value = PlayerMoney[player.Name].Value + 10000			
			elseif receiptInfo.ProductId == 36986755 then
				ReplicatedStorage:FindFirstChild("PlayerMoney")[player.Name].Value = PlayerMoney[player.Name].Value + 50000			
    		elseif receiptInfo.ProductId == 36986772 then
				PlayerMoney[player.Name].Value = PlayerMoney[player.Name].Value + 100000
			elseif receiptInfo.ProductId == 36986795 then
    			IlluminaTool:Clone().Parent = player.Backpack
  			elseif receiptInfo.ProductId == 36986787 then
			    SniperTool:Clone().Parent = player.Backpack
			end
		end
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

1 comment

0

Put a test in the function(not in any ifs) and see if that prints anything.