What did i do wrong with ProcessReceipt?

Basically, i tryed to make a cashgrab game because all my “efforts” game ended up failling all by all, so i attempted making this genre of products that trigers op actions for cheap prices.

However, when i attempted to call the purchase nothing happened and no error messages were meet.

game.MarketplaceService.ProcessReceipt = function(process)
	if process.PurchaseId == 2816614444 then
		for _, player in game.Players:GetPlayers() do
			if player.Character and player.Character:FindFirstChildOfClass("Humanoid") then
				player.Character.Humanoid.Health = 0
			end
		end
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end

print(process) to check whether the event calls into this function

I think you need process.ProductId, not process.PurchaseId (provided the id following is the id of the developer product)

If it’s not a developer product you need to use a different system since ProcessReceipt won’t work for non-devproduct purchases

1 Like

PurchaseId is a unique ID for each transaction (I think), while ProductId identifies the ID of the purchased product

This code should work:

game.MarketplaceService.ProcessReceipt = function(process)
	if process.ProductId == 2816614444 then
		for _, player in game.Players:GetPlayers() do
			if player.Character and player.Character:FindFirstChildOfClass("Humanoid") then
				player.Character.Humanoid.Health = 0
			end
		end
		
		return Enum.ProductPurchaseDecision.PurchaseGranted
	end
end
2 Likes