Process Receipt not working

Hello! I was working on Process Receipt system, but for some reason it wont work.
Im a bit confused on why this is happening because it wont even print.

Here is my code

local function ProcessGlowstick(receiptInfo)
	print("Passing")
	local plr = game.Players:GetPlayerByUserId(receiptInfo.PlayerId)
	if plr then
	for _,v in pairs(workspace.GlowstickPrompts:GetChildren())do
		if receiptInfo.ProductId == v.ClickDetector.ProductID.Value then
			local Tool = game.ReplicatedStorage.Gears:FindFirstChild(v.ClickDetector.ItemName.Value):Clone()
			Tool.Parent = plr.Backpack
			Tool.Parent = workspace
			Tool.Parent = plr.Character
			print("Worked")
			return Enum.ProductPurchaseDecision.PurchaseGranted
		else
				return Enum.ProductPurchaseDecision.NotProcessedYet
			end
		end
	else
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
end

MarketPlaceService.ProcessReceipt = ProcessGlowstick

If anyone could help me out that would be great :grinning_face_with_smiling_eyes:

1 Like

First question, do you have a donation board in the game you’re testing this on or anything that uses Processreceipt besides this?

Secondly, the way you have it set up for the returning is a bit weird. You should only make it return PurchaseGranted and NotProcessYet after it has finished looping through the children via variable that is true if the condiition was met and false if it wasnt

It’s also stated on the wiki that if u return it more than once it freaks out

1.Yes I do have 1 donation board in the game currently

  1. Yeah I was messing with it because I was trying to make this work :sweat_smile:

The donation board is taking up the only ProcessReceipt callback space there is, you need to make the donation board ProcessReceipt work with yours. I can help with that if I know the board used, which board are you using, the one by Nitefal?

Im using that board, as I did some modifications to it.

I made a post similar to how I made both a custom receipt and the donation board’s receipt work

This gives you the basic idea of how to do it, you just need to change what I had done around to make it work for yours.

From how you could do it

  • Make variable that checks if a produce was found
  • Go through the glowbands and if one of them had the id of the thing bought, do the stuff and set variable to true
  • If none of them had the id, check if it’s a donation product id and if it is, do the stuff
  • If it was neither of them, return NotProcessYet, other if the variable is true, return PurchaseGranted
1 Like

Thanks for the help! However how can I get rid of the process Receipt in the donation board, because its being required by an id.

It’s mentioned in my post, go to the Products module script, and uncomment the module.AbortCustomPurchases = true line

yeah I just saw that :sweat_smile: Thanks for the help:D

1 Like

You could use

tonumber( receiptInfo.ProductId) == tonumber(v.ClickDetector.ProductID.Value)