Devproduct help

I got a skip stage script that just adds 1 to the level leaderstat and reloads the character. however, it’s accumulating. for example, a player purchases it and it goes from 1 to 2, purchases it again it goes from 2 to 4, again 3 to 7, etc…

Assistance would be appreciated.

--Skip
productFunctions[123456789] = function(receipt, player)
	player.leaderstats.Level.Value += 1
	wait(1)
	player:LoadCharacter()
	return true
end


--ReceiptProcess
local function processReceipt(receiptInfo)
	local userId = receiptInfo.PlayerId
	local productId = receiptInfo.ProductId

	local player = Players:GetPlayerByUserId(userId)
	if player then
		-- Get the handler function associated with the developer product ID and attempt to run it
		local handler = productFunctions[productId]
		local success, result = pcall(handler, receiptInfo, player)
		if success then
			-- The user has received their benefits!
			-- return PurchaseGranted to confirm the transaction.
			remote:FireAllClients(player.Name, result)
			return Enum.ProductPurchaseDecision.PurchaseGranted
		else
			warn("Failed to process receipt:", receiptInfo, result)
		end
	end

	-- The user's benefits couldn't be awarded.
	-- return NotProcessedYet to try again next time the user joins.
	return Enum.ProductPurchaseDecision.NotProcessedYet
end

-- Set the callback; this can only be done once by one script on the server!
MarketplaceService.ProcessReceipt = processReceipt

I tried your exact code (excluding the remote event) and was not able to replicate this. Is there any other code involved that effects this?

I believe this is a bug with another script

I’d doubt this, as you can only set the ProcessReceipt callback to one method…

It’s bizzare… It should only happen once.

1 Like

What other scripts use that leaderstats?

just the one that handles the checkpoints