Script prompting the right dev product but when purchased doesn't execute the right handler?

i have a couple scripts in my game just for developer products, and sometimes it acts up and doesnt execute the right script after i purchase the dev product?

example: (random scenario) i would click a donate button, i would be prompted with the donation devproduct but when i press purchase it gives myself 200 coins (which would be another script)

script 1:

local gui = script.Parent.Parent.Parent.Parent.Parent.prompt
local id = 1132359762

script.Parent.MouseButton1Click:Connect(function()
	game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, id)
	wait(3)
	gui:TweenPosition(UDim2.new(0.914, 0, 0.106, 0))
	wait(1)
	gui:TweenPosition(UDim2.new(1.1, 0, 0.106, 0))
end)

(i dont have a server script for this, as its just a donation, but when i press the button,

script two executes

local function processReceipt(receiptInfo)
	
	local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
	if not player then
		
		return Enum.ProductPurchaseDecision.NotProcessedYet
	end
	
	if player then

-- blah blah

	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

MarketplaceService.ProcessReceipt = processReceipt

script two is a server script, and is activated by a button in workspace
the prompt:

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

local productID = 1119127385

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	MarketplaceService:PromptProductPurchase(player, productID)
	print("User " .. player.Name .. " prompted to purchase ignite")
end)

its usually broken both ways, sometimes i’d click the brick and purchase the right devproduct, but i’d receive the wrong thing

and if i click the gui for the donation thing, it would activate script 2

sometimes it works, and most times it doesnt.

any help would be appreciated

I don’t think the MarketplaceService.ProcessReceipt will do anything inside of a LocalScript, but I might be wrong here.

They have mentioned that script two is a script in server context

I assume you didn’t give the whole code of script two, but, did you setup an if statement to check whether the purchased product’s Id is the one to receive the actual product?

yeah, i did.
i actually had a old version of script 2 that im gonna show you because the new one is sorta broken, i replaced it because i thought that was the issue and just used the one from the wiki instead,

the main difference is instead of a function and the script having a callback (old script), my new script doesn’t have

MarketplaceService.ProcessReceipt = processReceipt

and uses

mpService.ProcessReceipt = function(purchaseInfo)
	local plr = game:getService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId)
	if purchaseInfo.ProductId == 1119127385 then
-- blah blah
	end
	return Enum.ProductPurchaseDecision.PurchaseGranted
end

instead. so yes, i don’t think i had included a statement to check the id to match, but the old script had issues with this aswell, so idk if that’s the main problem