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

multiple developer product error?

Asked by
DanzLua 2879 Moderation Voter Community Moderator
9 years ago

Hey, ok so, i have a surface gui and on that surface gui i have three textbuttons each with the same script witch is here below

~~~~~~~~~~~~~~~~~

--Script in BuyButton part --ignore this part local click1 = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Customer_View").SurfaceGui.Frame.Frame.tic1 local click2 = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Customer_View").SurfaceGui.Frame.Frame.tic2 local click3 = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Customer_View").SurfaceGui.Frame.Frame.tic3 local pay1 = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Customer_View").SurfaceGui.Frame.Pay1 local pay2 = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Customer_View").SurfaceGui.Frame.Pay2 local pay3 = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Customer_View").SurfaceGui.Frame.Pay3 local pwait = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Customer_View").SurfaceGui.Frame.Frame.pwait local ccancel = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Customer_View").SurfaceGui.Frame.Cancel local cancel = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Worker_View").SurfaceGui.Frame.cancel local wclick1 = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Worker_View").SurfaceGui.Frame.click1 local wclick2 = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Worker_View").SurfaceGui.Frame.click2 local wclick3 = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Worker_View").SurfaceGui.Frame.click3 local Declined = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Worker_View").SurfaceGui.DECLINED local numgone = script.Parent.Parent.Parent.Parent.Parent:FindFirstChild("Worker_View").SurfaceGui.Frame.Frame.pick

-- setup local variables local MarketplaceService = game:GetService("MarketplaceService") local productId = 21992025

-- define function that will be called when purchase finished MarketplaceService.ProcessReceipt = function(receiptInfo)

-- find the player based on the PlayerId in receiptInfo
for i, player in ipairs(game.Players:GetChildren()) do
    if player.userId == receiptInfo.PlayerId then


        -- check which product was purchased
        if receiptInfo.ProductId == productId then

            -- handle purchase

script.Parent.Parent.Parent.Parent.Parent.Worker_View.SurfaceGui.accept.Visible = true script.Parent.Parent.Parent.Parent.Parent.Worker_View.SurfaceGui.Frame.Frame.pick.Visible=false

wait(3) script.Parent.Parent.Parent.Parent.Parent.Worker_View.SurfaceGui.accept.Visible = false script.Parent.Parent.Parent.Parent.Parent.Worker_View.SurfaceGui.Frame.Frame.pick.Visible =true pwait.Visible = true click1.Visible = false click2.Visible = false click3.Visible = false pay1.Visible = false pay2.Visible = false pay3.Visible = false cancel.Visible = false wclick1.Visible = true wclick2.Visible = true wclick3.Visible = true ccancel.Visible = false

        end
    end
end 



-- tell ROBLOX that we have successfully handled the transaction
return Enum.ProductPurchaseDecision.PurchaseGranted     

end

**and in the Starterpack i have this local script 
**~~~~~~~~~~~~~~~~~




--LocalScript in StarterPack
-- setup local variables
local buyButton = game.Workspace.ComputerMechanics1.Customer_View.SurfaceGui.Frame.Pay1
local productId = 21992025

-- when player clicks on buy brick prompt him/her to buy a product
buyButton.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)




--LocalScript in StarterPack
-- setup local variables
local buyButton = game.Workspace.ComputerMechanics1.Customer_View.SurfaceGui.Frame.Pay2
local productId = 21992101

-- when player clicks on buy brick prompt him/her to buy a product
buyButton.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)



--LocalScript in StarterPack
-- setup local variables
local buyButton = game.Workspace.ComputerMechanics1.Customer_View.SurfaceGui.Frame.Pay3
local productId = 21992105

-- when player clicks on buy brick prompt him/her to buy a product
buyButton.MouseButton1Click:connect(function()
    game:GetService("MarketplaceService"):PromptProductPurchase(game.Players.LocalPlayer, productId)
end)






the problem is when someone click the first gui it prompts the developer product for them to buy and when they buy it nothing happens same with the third gui. but when some one buys the second gui it does what i want it to do which is located in the script. The only error i get when i go to play the game and i go to the developer console and after i bought the developer product is RbxUtility.DecodeJSON is deprecated, please use Game:GetService("HttpService"):JSONDecode() instead Thanks.

Answer this question