(URGENT) Developer Product Handler Not Working

i want to print something when player buys a developer product and for some reason my script won’t work. i appreciate a lot if you help me

server script(ServerScriptService):

local MarketplaceService = game:GetService("MarketplaceService")

local robux_10 = 1319870523


MarketplaceService.ProcessReceipt = function(receiptInfo)
	
	for i,v in pairs(game.Players:GetChildren()) do
		if v.userId == receiptInfo.PlayerId then
			if receiptInfo.ProductId == robux_10 then
				print("thanks")
			end
		end
	end


	return Enum.ProductPurchaseDecision.PurchaseGranted		
end

local script:

local marketplaceServie = game:GetService("MarketplaceService")

script.Parent.MouseButton1Click:Connect(function()

marketplaceServie:PromptProductPurchase(game.Players.LocalPlayer,1319870523)

end)

.

I tested the server script itself and it ran fine with the print.
Are you getting a display for purchasing the product?

Have you enabled API Services?

yes i get display for purchasing. maybe my studio buggin?

i mean i think its really should work but i don’t get any prints

Unrelated but there can be only script that handles dev products no more than one.

That’s true.

Do you have any other scripts that is doing ProcessReceipt = function(receiptInfo) artum?

yes i enabled API Services and its not printing anything

no, its my only script that handles any type of marketplace purchases

Where do you have the server script stored?

as i wrote up there in the top its in ServerScriptService

Using the roblox example script for dev products can you try this one?

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

local productFunctions = {}


productFunctions[1319870523] = function(receipt, player)
	print("thanks")
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 product ID and attempt to run it
		local handler = productFunctions[productId]
		local success, result = pcall(handler, receiptInfo, player)
		if success then
			-- The player 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 player's benefits couldn't be awarded.
	-- return NotProcessedYet to try again next time the player 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 it and its still not printing anything really wierd

You should try looking at the page for dev products then
https://create.roblox.com/docs/production/monetization/developer-products

thats what i did before i posted this, also i am still reading it and trying to figure out where is my problem thats should print something.

i also tried to join inside my game and it won’t work

Why is your v.userId with a lowercase? It should be v.UserId. Didn’t it give you errors about this part?

no errors at all. no in the studio and not in the actual game i will try to replace what you said and check

yep it didn’t work with the fix you suggested. still no errors still no any prints in the output in the studio and in the actual game

Also try putting a print statement at the very start of your server script, before even the variables, to see if the script even is in the game

yes the script in the studio and in the actual ggame, i tried the print statment you said

I don’t know then, last thing you can try is making your local script a server script, like this

local marketplaceServie = game:GetService("MarketplaceService")
local player = script:FindFirstAncestor("PlayerGui").Parent

script.Parent.MouseButton1Click:Connect(function()

marketplaceServie:PromptProductPurchase(player,1319870523)

end)

If this doesn’t work, delete studio. Don’t reinstall it. Just delete it.