I tried out this code and it worked!
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
MarketplaceService.ProcessReceipt = function(receiptInfo)
if receiptInfo.ProductId == 0000 then
local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
if player then
print(1)
return Enum.ProductPurchaseDecision.PurchaseGranted
else
return Enum.ProductPurchaseDecision.NotProcessedYet
end
end
end