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

Help with tables and for loops?

Asked by 9 years ago
local shop = {creditshop:WaitForChild("10Credits"),creditshop:WaitForChild("50Credits")}


for _, v in pairs (shop[1]) do
    v.MouseButton1Click:connect(function()
        local passId = 21545568
        game:GetService("MarketplaceService"):PromptProductPurchase(player,passId)
        game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo)
            if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == player.userId then
                player.Credits.Value = player.Credits.Value + 10
                wait(1)
            end
        end
    end)
end
2
Please give us a summary of your problem in the body. RedCombee 585 — 9y
0
well it just isnt working. I cant test in studio cause it uses dev products, so I don't know whats wrong. I want it so if the 10credits button is clicked then do stuff NinjoOnline 1146 — 9y
0
Well, you really don't need to use a table for this. Get rid of the for loop, and just make it so when they click a 10 Credits button and they but it it awards them 10 Credits, same with 50. Tables make it less efficient, actually. SlickPwner 534 — 9y
0
4 down votes, wow sorry retards for asking a question, a legitement question. Morons. NinjoOnline 1146 — 9y
0
Well, you posted code with no explanation of the problem what so ever. Don't expect up votes for a poorly written question. Spongocardo 1991 — 9y

Answer this question