Problem with a Dev Product

I’m trying to get this code to work but it seems as if the server isn’t even recognizing the payment, as “processing” is never being printed.
The code works perfectly fine in another test game where I created it, but when I went to move it over to the real game, of course, it just breaks.
My initial thought was some other script is interfering with this one, so I tried to disable all other scripts and see if it worked then (It didn’t). I’ve also simply tried fiddling with the script, but nothing seems to make it work.

local MarketPlaceService = game:GetService("MarketplaceService")
local repStorage = game:GetService("ReplicatedStorage")
local fireBack = repStorage:WaitForChild("Events").FireBack
local Players = game:GetService("Players")
local Id = 1354380150
local productFunctions = {

}
local function create_datastore(Player, player_target)
	local DSS = game:GetService("DataStoreService")
	local users_purchased_for = DSS:GetDataStore("Players Purchased")
	users_purchased_for:SetAsync(player_target, true)
end
productFunctions[Id] = function(receipt, player)
	if player.Character and player.Character:FindFirstChild("Humanoid") then
		return true
	end
end

local function processReceipt(receiptInfo)
	print("processing")
	local DSS = game:GetService("DataStoreService")
	local users_purchased_for = DSS:GetDataStore("Players Purchased")
	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
			fireBack:FireClient(player)
			return Enum.ProductPurchaseDecision.PurchaseGranted
		else
			warn("Failed to process receipt:", receiptInfo, result)
			return Enum.ProductPurchaseDecision.NotProcessedYet
		end
	end
end

MarketPlaceService.ProcessReceipt = processReceipt

fireBack.OnServerEvent:Connect(function(Player, player_targetted)
	print(Player.Name .. " : " .. player_targetted)
	print("recieved fireback")
	create_datastore(Player,player_targetted)
end)

Other info:

  • This is in a server script, inside of ServerScriptService
  • The prompt purchase button is inside of a screen UI, and works as intended.
  • Yes, this script uses server - client - server events, but they aren’t in use before the “processing” should be printed so it shouldn’t have any affect on this situation.

I’m really not sure what the problem is, if anyone could help me that’d be amazing!

Make sure nothing else is connected to the processReceipt event. Other than that I do not know

It’s not the best way to do what you want, but you can just store the data in a local variable.
local players = {}

fireBack.OnServerEvent:Connect(function(Player, player_targetted)
print(Player.Name … " : " … player_targetted)
print(“recieved fireback”)
table.insert(players, player_targetted)
end)

Well, I do need the player’s information indefinitely so I can’t just store it in a variable.