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

Why isn't the SINGLE developer product working???!

Asked by
ItsMeKlc 235 Moderation Voter
7 years ago
Edited 7 years ago

Here's the code for my developer products:

local MarketplaceService = game:GetService("MarketplaceService")
local character1, character2, character3, slotid, subs1250, subs100, views25000, views5000 = 42907443, 46536618, 46536644, 45098689, 45145715, 45145621, 45160253, 45160240
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")

MarketplaceService.ProcessReceipt =  function(receiptInfo) 
    local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.ProductId
    if PurchaseHistory:GetAsync(playerProductKey) then
        return Enum.ProductPurchaseDecision.PurchaseGranted
    end
    for i, player in ipairs(game.Players:GetPlayers()) do
        if player.userId == receiptInfo.PlayerId then
            print(receiptInfo.ProductId)
            if receiptInfo.ProductId == character1 then
                player.skins[player.PlayerGui.GUI.main_menu.character_select.buy_skins.skin1.Value].Value = 1           
            elseif receiptInfo.ProductId == character2 then
                print("hey u should haz it")
                player.skins[player.PlayerGui.GUI.main_menu.character_select.buy_skins.skin2.Value].Value = 1
            elseif receiptInfo.ProductId == character3 then
                print("3 werks")
                player.skins[player.PlayerGui.GUI.main_menu.character_select.buy_skins.skin3.Value].Value = 1
            elseif receiptInfo.ProductId == slotid then      
                player.data.slots.Value = player.data.slots.Value + 1
            elseif receiptInfo.ProductId == subs1250 then      
                player.leaderstats.Subscribers.Value = player.leaderstats.Subscribers.Value + 1250
            elseif receiptInfo.ProductId == subs100 then      
                player.leaderstats.Subscribers.Value = player.leaderstats.Subscribers.Value + 100
            elseif receiptInfo.ProductId == views25000 then
                player.leaderstats.Views.Value = player.leaderstats.Views.Value + 25000
            elseif receiptInfo.ProductId == views5000 then
                player.leaderstats.Views.Value = player.leaderstats.Views.Value + 5000
            else


            end
        end 
    end
    PurchaseHistory:SetAsync(playerProductKey, true)    
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end
--[[
local MarketplaceService = game:GetService("MarketplaceService")
local character1, slotid,subs1250, subs100, views25000, views5000 = 42907443, 45098689, 45145715, 45145621, 45160253, 45160240
local PurchaseHistory = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")

MarketplaceService.ProcessReceipt = function(receiptInfo) 
    local playerProductKey = receiptInfo.PlayerId .. ":" .. receiptInfo.PurchaseId
    if PurchaseHistory:GetAsync(playerProductKey) then
        return Enum.ProductPurchaseDecision.PurchaseGranted --We already granted it.
    end
    -- find the player based on the PlayerId in receiptInfo
    for i, player in ipairs(game.Players:GetPlayers()) do
        if player.userId == receiptInfo.PlayerId then
            -- check which product was purchased (required, otherwise you'll award the wrong items if you're using more than one developer product)
            if receiptInfo.ProductId == character1 then
                player.skins[tostring(player.PlayerGui.GUI.main_menu.character_select.buy_skins.skin.Value)].Value = player.skins[tostring(player.PlayerGui.GUI.main_menu.character_select.buy_skins.skin.Value)].Value + 1 
            elseif receiptInfo.ProductId == slotid then      
                player.data.slots.Value = player.data.slots.Value + 1
            elseif receiptInfo.ProductId == subs1250 then      
                player.leaderstats.Subscribers.Value = player.leaderstats.Subscribers.Value + 1250
            elseif receiptInfo.ProductId == subs100 then      
                player.leaderstats.Subscribers.Value = player.leaderstats.Subscribers.Value + 100
            elseif receiptInfo.ProductId == views25000 then
                player.leaderstats.Views.Value = player.leaderstats.Views.Value + 25000
            elseif receiptInfo.ProductId == views5000 then
                player.leaderstats.Views.Value = player.leaderstats.Views.Value + 5000
            --elseif then

            end
        end 
    end
    -- record the transaction in a Data Store
    PurchaseHistory:SetAsync(playerProductKey, true)    
    -- tell ROBLOX that we have successfully handled the transaction (required)
    return Enum.ProductPurchaseDecision.PurchaseGranted     
end

    ]]

For some reason, EVERY single product works, EXCEPT for the 2nd one (character2/46536618). Why is this? I've tested it in all modes... [EDIT: I just made a new product and replaced the ID here. It's working fine, but I still want to know why the original ID isn't working :L]

1
maybe you got the wrong id? DrPredablox 153 — 7y
0
^ Has to be that. RubenKan 3615 — 7y

Answer this question