|
| 30 Jun 2015 02:03 PM |
I can check if a slot is taken, but I'm not sure how to check and make something happen if all of them are. Here is a snippet of my code. It may look like a lot, but actually it isn't.. I think.
--snip snip-- table_inventory = {}
function getSlot(slotid) for i,v in pairs(script.Parent.Slots:GetChildren()) do if v.Name == "Slot_"..slotid then if v:findFirstChild("SlotId") then if v.SlotId.Value == slotid then return v end end end end end
if inventory then inventory.ChildAdded:connect(function(child) if debug_mode == true then print("Child added!") table.insert(table_inventory, #table_inventory+1, child.Name) print(#table_inventory) wait(1) local slot = getSlot(#table_inventory) if slot:IsA("Frame") then print("Slot is real.") if #slot:GetChildren() > 2 then return false else local arg = Instance.new("ObjectValue", slot) arg.Name = child.Name arg.Value = child print("added child.") slot.Information.Text = child.Name slot.Information.Visible = true end end end end) end |
|
|
| Report Abuse |
|
| |