So my remote functions job is to check if the player owns a certain dev product, if they do it should return true and allow the function to continue. Instead, it returns nil. I have no clue why?

Local Script

spin.MouseButton1Down:Connect(function()
	local id = 985025707
	warn("A")
	
	game:GetService("MarketplaceService"):PromptProductPurchase(player, id)
	
	local success, errorMessage = game.ReplicatedStorage.Test:InvokeServer(id)
	
	while wait(1) do
	
	print("B")
		
		if not success then
			
			warn("False")
			
		elseif not errorMessage then
			
			warn("True")
			
	else
			
		warn("Failure")
		warn(success)
		warn(errorMessage)

	end
	end
end)

Server Script

local event = game.ReplicatedStorage.Test

local module = require(script.Parent.HatModule)	

function getPlayerFromId(id)
	for i,v in pairs(game.Players:GetChildren()) do
		if v.userId == id then
			return v
		end
	end
	return nil
end

event.OnServerInvoke = function(player ,id)
	
	local MarketplaceService = game:GetService("MarketplaceService")
	
	MarketplaceService.ProcessReceipt = function(receiptInfo)
		
		local ID = id
		
		local productId = receiptInfo.ProductId
		local playerId = receiptInfo.PlayerId
		local player = getPlayerFromId(playerId)
		local productName
		
		if productId == ID then
			
			warn("TRUE")
			return true
			
		else
			
			warn("FALSE")
			return false
			
		end
	
	end
	
end

The local script prints

Failure, Nil, Nil

2 comments

0

???

0

Help