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

Why is my developer product not working?

Asked by 7 years ago
Edited by M39a9am3R 7 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

Hi! I am trying to make a developer product for my Tycoon. For example I want the product to give $500 cash when a player buys it for $50 robux. I did the scripting and it does not work I will list them

ServerScriptService:

local MarketplaceService = game:GetService('MarketplaceService')
local devproductid = 46984208 -- 500 cash

MarketplaceService.ProcessReceipt = function(receiptInfo)
    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then
            if receiptInfo.ProductId == devproductid then

                -- give them cash
                player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 500
            end
        end

    end
    return Enum.ProductPurchaseDEcision.PurchaseGranted
end

Workspace:

game.Players.PlayerAdded:connect(function(plr)
    local stats = Instance.new('BoolValue', plr)
    stats.Name = 'leaderstats'
    local cash = Instance.new('IntValue', stats)
    cash.Name = 'Cash'  
    cash.Value = 0 
end)



Gui (local script):

local button = script.Parent
local devproductid = 46984208

button.MouseButton1Click:connect(function()
    game:getSerivce('MarketplaceService'):PromotProductPurchase(game.Players.LocalPlayer, devproductid)
end)

If anyone knows why it wont work please help! All appreciated :)

0
Please fix your codeblocks ;) RubenKan 3615 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Have you got a Leaderboard? Make a developer product: 1 . Go to Your game 2 . Press the 3 dots. 3. Press configure game. 4. Press developer products 5. Design your product. Instead of making your own script, why not try this: https://www.roblox.com/library/338900862/Zeds-Dev-Product-Kit

Ad

Answer this question