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

How to properly use Developer Products?

Asked by
Shawnyg 4330 Trusted Badge of Merit Snack Break Moderation Voter Community Moderator
10 years ago

I asked this about a week or two ago, still no helping answer. This Developer Product script is supposed to give a script to a player's character (The script is fine), but I've heard that when people purchase the product, they don't get the script. Any tips?

-- setup local variables
local MarketplaceService = Game:GetService("MarketplaceService")
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local productId = 22055633

game.Players.PlayerAdded:connect(function()
local DeveloperProducts = game:GetService("MarketplaceService"):GetDeveloperProductsAsync():GetCurrentPage()
for _, DevProductContainer in pairs(DeveloperProducts) do
    for Field, Value in pairs(DevProductContainer) do
        print(Field .. ": " .. Value)
    end
end
end)


MarketplaceService.ProcessReceipt = function(receiptInfo) 

    for i, player in ipairs(game.Players:GetChildren()) do
        if player.userId == receiptInfo.PlayerId then
            if receiptInfo.ProductId == productId then
                player.Character.Humanoid.Jump = true -- If they are sitting
                player.Character:MoveTo(game.Workspace.ViewpointManager.TeleportPart.Position) -- Will teleport em
                print('1')
                a = script.Script
                print('2')
                a:clone().Parent = player.Character
                print('3')
                player.Character.Script.Disabled = false
                print('4')
                b = script.ATimingGUI
                print('5')
                b:clone().Parent = player.PlayerGui
                print('6')
                player.PlayerGui.ATimingGUI.Frame.Time.Script.Disabled = false
                print('7')
            end
        end
    end 

    local playerProductKey = "p_" .. receiptInfo.PlayerId .. "_p_" .. receiptInfo.PurchaseId
    ds:IncrementAsync(playerProductKey, 1)  

    return Enum.ProductPurchaseDecision.PurchaseGranted     
end 

Answer this question