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
COMMUNITY QUESTION
Help with tables and for loops?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

5 comments
Please give us a summary of your problem in the body.
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
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.
4 down votes, wow sorry retards for asking a question, a legitement question. Morons.
Well, you posted code with no explanation of the problem what so ever. Don't expect up votes for a poorly written question.