Script won't continue after function activation

Hello Roblox Dev Community,

Info

Code
marketPlaceService.ProcessReceipt = function(receipt)
	local player = plrs:GetPlayerByUserId(receipt.PlayerId)
	local assetId = receipt.ProductId
	if plr == player then
		if assetId == productId then
			if groupRunning then local groupVal = queueValTemplate:Clone() groupVal.Name = groupInfo["Name"] groupVal.Value = (#queueFolder:GetChildren() + 1) groupVal.GroupId.Value = input groupVal.Parent = queueFolder return end
			groupRunning = true
			ProcessModule:runGroup(input)
		end
	end		
	print("Purchase Granted")
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

So the problem is that when i do the ProcessReceipt function thing. I need to run a module function at the end, but the problem is that i have to add a return PurchaseGranted so that the script knows the player bought it. And i am trying to run them bove, but when i firsly activate the module function then the further of the ProcessReceipt function is not running anymore. So that means it cannot activate the return PurchaseGranted. But when i try doing the return PurchaseGranted first, then the ProcessReceipt will stop so then the module won’t be able to run.

Achieve
So what i want to achieve is that the module function can run and that the process receipt get’s to know the player bought is, because otherwise the module is getting runned multiple times.

I hope everyone has an good day!
:waffle: :wave:

Put the “ProcessModule:runGroup(input)” inside a spawn function. This will allow the rest of the code to run and the function.

spawn(function()
    ProcessModule:runGroup(input)
end)
1 Like

Thank you so much, you deserve 20 waffles with bove sided cold on your pillow tonight.

1 Like