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

Developer Product: 2 Different purchase buttons but give the same thing?

Asked by
Ben_B 9
4 years ago

I have a GUI which has 2 different developer products to buy, but both of them give me the same purchase? One is for 1000 credits, the other is for 5000. The 1000 one works fine but when i press on the 5,000 one, it prompts me for the right id but then only gives me 1000 credits, please help. Code inside purchase buttons:

local main = script.Parent
local button = script.Parent
local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = 985109115
local player = game.Players.LocalPlayer




button.MouseButton1Down:Connect(function()
    MarketPlaceService:PromptProductPurchase(player, ProductId)


end)



local main = script.Parent
local button = script.Parent
local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = 982191893
local player = game.Players.LocalPlayer




button.MouseButton1Down:Connect(function()
    MarketPlaceService:PromptProductPurchase(player, ProductId)

end)



scripts inside ServerScriptService:
local MarketPlaceService = game:GetService("MarketplaceService") local players = game:GetService("Players") local ProductId = 982191893 local function processReceipt(receiptInfo) local player = players:GetPlayerByUserId(receiptInfo.PlayerId) if not player then return Enum.ProductPurchaseDecision.NotProcessedYet end if player then local new = player.leaderstats.Credits.Value + 1000 print ("Working") game.Workspace.Sounds.PurchaseSound:Play() player.leaderstats.Credits.Value = new end return Enum.ProductPurchaseDecision.PurchaseGranted end MarketPlaceService.ProcessReceipt = processReceipt
local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = 985109115

local function processReceipt(receiptInfo)
    local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
    if not player then
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end

        if player then
    print ("Working")
        game.Workspace.Sounds.PurchaseSound:Play()
            local new = player.leaderstats.Credits.Value + 5000
    player.leaderstats.Credits.Value = new
        end
        return Enum.ProductPurchaseDecision.PurchaseGranted
end


MarketPlaceService.ProcessReceipt = processReceipt

Thanks.

1 answer

Log in to vote
0
Answered by
Ben_B 9
4 years ago

I found the problem, I just need to assign the ProductId into this script but where and how would i do it?

local MarketPlaceService = game:GetService("MarketplaceService")
local players = game:GetService("Players")
local ProductId = 985109115

local function processReceipt(receiptInfo)
    local player = players:GetPlayerByUserId(receiptInfo.PlayerId)
    if not player then
        return Enum.ProductPurchaseDecision.NotProcessedYet
    end

        if player  then
    print ("Working")
        game.Workspace.Sounds.PurchaseSound:Play()
            local new = player.leaderstats.Credits.Value + 5000
    player.leaderstats.Credits.Value = new
        end
        return Enum.ProductPurchaseDecision.PurchaseGranted
end


MarketPlaceService.ProcessReceipt = processReceipt
Ad

Answer this question