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

Not giving the money from the Developer Product?

Asked by
22To 70
8 years ago

Works, but when they buy they get no money?

--

local devProductId = 33890734   --The Developer Product ID if your item, must be a Product of the game place it is in
local player= script.Parent.Parent.Parent.Parent.Parent

--Well, as always, don't touch anything below if you have no idea what you are doing--

--Prompt Buy--
script.Parent.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(player, devProductId)
end)

--Transaction--
local MarketplaceService = game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
MarketplaceService.ProcessReceipt = function(receiptInfo)
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then
            if receiptInfo.ProductId == devProductId then       --you can put the event here, or whatever
                local L = game.ServerStorage.MoneyStorage[player.Name]
                     if (L ~= nil) then
                     L.Value = L.Value + 5000 --- Amount of cash goes here.
            end
        end
    end
    local playerProductKey = "player_" .. receiptInfo.PlayerId .. "_purchase_" .. receiptInfo.ProductId
        ds:IncrementAsync(playerProductKey, 1)  
    return Enum.ProductPurchaseDecision.PurchaseGranted
    end
    end
0
Try in pairs but tbh i cant see any error in the script. Try checking values and if the variables are correct. LifeInDevelopment 364 — 8y
0
idk why it isnt working like for real. 22To 70 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

I can't write all of the script but maybe this helps. http://wiki.roblox.com/index.php?title=Developer_product

Ad

Answer this question