I'm making an advanced purchase script, but it isn't working. Instead of having to painfully type in a ton of numbers, you could just set the ID of an item and it would take that and put it in a table.
--Give cash on payment
--written 6/24/2014 by ChipioIndustries for Tycoon Kit
--copyright 2014 Chipio Industries, L.L.C.
wait(1)
local ids={}
local items=script.Parent.Frame:GetChildren()
for i=1,#items do
ids[i].id=items[i].ID.Value --this line has an error.
ids[i].value=items[i].Name:sub(1,#items[i]-1)
end
local MarketplaceService = Game:GetService("MarketplaceService")
local plr=script.Parent.Parent.Parent.Parent.Parent
MarketplaceService.ProcessReceipt = function(receiptInfo)
if receiptInfo.PlayerId==script.Parent.Parent.Parent.Parent.Parent.userId then
for i=1,#ids do
if receiptInfo.ProductId==ids[i].id then
plr.leaderstats.Cash.Value=plr.leaderstats.Cash.Value+ids[i].value
break
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
Here's the error:
attempt to index field '?' (a nil value)
And this is what the Explorer looks like:
Player
PlayerGui
Menu
Menu2
Open
Buy Cash
Open
Purchase --script is here.
Frame
100K
ID
Script
10K
ID
Script
15K
ID
Script
20K
ID
Script
25K
ID
Script
50K
ID
Script
5K
ID
Script
75K
ID
Script
Any ideas on how to fix this?

2 comments
That didn't work.
It fixed that part, but now it doesn't return any errors.