#developer product

1 messages · Page 1 of 1 (latest)

reef mango
#
local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local ProductToQuantity = {
    [3296774010] = 25000,
    [3296774101] = 100000,
    [3296774225] = 250000,
}

local purchaseEvent = ReplicatedStorage:WaitForChild("PurchaseEvent")

-- Handle the remote event fired from the client to prompt purchase
purchaseEvent.OnServerEvent:Connect(function(player, productId)
    if typeof(productId) == "number" then
        MarketplaceService:PromptProductPurchase(player, productId)
    end
end)

-- Process the purchase receipt and award the correct amount of money
local function processReceipt(receiptInfo)
    local player = Players:GetPlayerByUserId(receiptInfo.PlayerId)
    if not player then
        -- Player not found, defer processing
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end
    
    local productId = receiptInfo.ProductId
    local quantity = ProductToQuantity[productId]

    if quantity then
        local leaderstats = player:FindFirstChild("leaderstats")
        if leaderstats then
            local moneyStat = leaderstats:FindFirstChild("Money")
            if moneyStat then
                moneyStat.Value = moneyStat.Value + quantity
            end
        end
    end
    
    return Enum.ProductPurchaseDecision.PurchaseGranted
end

MarketplaceService.ProcessReceipt = processReceipt

why does this only work 1 time and after i rejoin nothing happens???

i have been stuck with this for day and i have no clue how to fix this

jagged horizon
#

And wdym exactly works 1 time

#

What happends if 2nd time

reef mango
#

nothing

#

so

#

when i first tested the script i was able to buy all the products without any problems

#

when i left and rejoined and i bought it again nothing happened

reef mango
#

nope

jagged horizon
#

Huh

#

Naw u defo doing smth wrong

zinc oak
#

The studio, the game?

reef mango
#

Yes

zinc oak
reef mango
#

Studio

zinc oak
#

there is two options there

reef mango
#

Test playing in studio