ScriptOnJoin Date: 2010-08-22 Post Count: 10885 |
function fillcanvas()
for i,v in pairs(script.Parent:GetChildren()) do
if v ~= script then v:Destroy() end
end
limiteds = {}
local x = 0
local y = 0
for i,v in pairs(_G.collectibles:GetChildren()) do
local name, id = _G.decodelimited(v.Name)
table.insert(limiteds, name)
table.insert(limiteds, tonumber(id))
wait()
local picture = findpicture(name)
local frame = script.Item:clone()
frame.WhiteFrame.ImageButton.Image = "http://www.roblox.com/asset/?id="..picture
frame.WhiteFrame.Cost.Value = cost
frame.WhiteFrame.ID.Value = limiteds[i+1]
if id ~= nil then
frame.ItemName.Text = name.." #"..id
else
frame.itemNmae.Text = name
end
frame.Name = v.Name
frame.Position = UDim2.new(0,6+(x*124),0,6+(y*99))
frame.Parent = script.Parent
x = x+1
if x == 3 then
x = 0
y = y+1
end
frame.WhiteFrame.ImageButton.MouseButton1Down:connect(function()
print(v.Name)
if _G.furniture then
_G.furniture:Destroy()
end
print(_G.collectibles.Parent.Name)
for i,v in pairs(_G.collectibles:GetChildren()) do
print(v.Name)
end
_G.inventoryitem = _G.collectibles[frame.Name]
_G.owned = false
_G.furniturecost = 0
_G.furniture = game.ReplicatedStorage.Furniture[frame.Name]:clone()
_G.furniture.Parent = _G.apartment
_G.furniture.CanCollide = false
_G.furniture.Transparency = 0.4
for i,vv in pairs(_G.furniture:GetChildren()) do
if vv:IsA("Part") then
vv.Transparency = 0.4
vv.CanCollide = false
end
end
end)
end
script.Parent.CanvasSize = UDim2.new(0,0,0,6+(math.ceil(#limiteds/6)*99))
end
Alright so the only important things here are when I name the frame and when I try to get the frame again.
Whats happening: I click on button, it says the items name (Xblox 1), prints all items (In this case Xblox One1 and uPad Air1), then tells me that even though it literally just called out Xblox One1 as a child of _G.collectibles, it can't find it there, and its not a valid member of _G.collectibles, even though the frames are named AFTER THE COLLECTIBLES. What. |