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

ProcessRecipt With Dev Prodcuts Not Working?

Asked by 5 years ago
Edited 5 years ago

This is where it is processing all the dev product purchases

game.StarterGui.ResetPlayerGuiOnSpawn = false

local MarketplaceService = game:GetService("MarketplaceService")

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

MarketplaceService.ProcessReceipt = function(receiptInfo)
    local productId = receiptInfo.ProductId
    local playerId = receiptInfo.PlayerId
    local player = getPlayerFromId(playerId)
    local productName 
    if productId == 30628107 then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
        if cashmoney then
            cashmoney.Value = cashmoney.Value + 1000
        end
    elseif productId == 30628124 then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
        if cashmoney then
            cashmoney.Value = cashmoney.Value + 3000
        end
        elseif productId == 30628139 then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
        if cashmoney then
            cashmoney.Value = cashmoney.Value + 10000
        end
    elseif productId == 29731900 then
        local cashmoney = game.ServerStorage.PlayerMoney:FindFirstChild(player.Name)
        if cashmoney then
            cashmoney.Value = cashmoney.Value + 35000
        end
    elseif productId == 30987054 then
        local char = player.Character
        if char then
            local human = char:FindFirstChild("Humanoid")
            if human then
                human.WalkSpeed = human.WalkSpeed + 15
            end
        end
    elseif productId == 30987628 then
        game.ReplicatedStorage.GravityCoil:Clone().Parent = player.Backpack
    end

    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

This is the GUI local script

local productId = 30628107
local player = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(player, productId)
end)

When you buy the dev product it isn't giving the cash, no errors either.

Answer this question