Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't this Product code grant me profit?

Asked by
coo1o 227 Moderation Voter
9 years ago

Hello, I have a little question about my product code. For whatever reason, it doesn't grant me any profit.

Here's the code (In a server script):

local market = game:GetService("MarketplaceService")
local purchases = game:GetService("DataStoreService"):GetDataStore("Purchases")

function GetLocalGame(player)
    return player:WaitForChild("PlayerGui"):FindFirstChild("game") --game is a ScreenGui
end



market.ProcessReceipt = function(receipt)
    for _,v in pairs(game.Players:GetPlayers()) do
        if v.userId == receipt.PlayerId then
            local game = GetLocalGame(v):WaitForChild("product_function"):InvokeClient(v,receipt) --This RemoteFunction contains the code that runs when this product is purchased

            purchases:IncrementAsync(tostring(v.userId) .. "::" .. tostring(receipt.ProductId))
            print(v.Name," (",v.userId,") bought ",receipt.ProductId,"\n","info ",receipt.PurchaseId)
        end
    end
    return Enum.ProductPurchaseDecision.PurchaseGranted --Tell the market that the purchase has succeeded
end

The purchase was prompted in this code (LocalScript):

function testProduct()
    game:GetService("MarketplaceService"):PromptProductPurchase(player,20336741,false,"Robux")
end

The product costs 10 Robux, but whenever anyone buys it, I get absolutely no profit (Points are added to the game budget though)

Thanks ~coo1o

1 answer

Log in to vote
3
Answered by
2eggnog 981 Moderation Voter
9 years ago

Money made from products are held as Pending Sales in your Money tab. You'll receive the money in a couple days.

0
Oh, thanks for reminding me. I read this up a while ago but must've forgoten. Thanks again! coo1o 227 — 9y
Ad

Answer this question