Dev product works in studio not in-game?

I used Roblox’s script they have; it works perfectly fine in studio but in-game you do NOT get the rewards…?

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

local productFunctions = {}

productFunctions[1646206045] = function(receipt, player)
	player.leaderstats.Ultra.Value = player.leaderstats.Ultra.Value + 4320
end

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.
			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
1 Like

So once a payment has started ‘processing’ it will run the associated product function. In this case you’re incrementing a ‘Ultra’ leaderstat value.

You’ve not given enough detail in to what is/is not happening. Do you originally get credited the ‘Ultra’ stat and it doesn’t save? Does your leaderboard not show ‘Ultra’? Have you checked developer console in game for any associated errors? If you could clarify, someone may be able to help you.

there is an Ultra stat in-which saves. There are zero errors.
Works perfectly in studio.

So, to further clarify, you just don’t get credited any ‘Ultra’ when you purchase it in-game? However, in studio, it works?

yep exactly like that, no idea why too