generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

How do I check if all slots are taken?

Previous Thread :: Next Thread 
shinxlocke is not online. shinxlocke
Joined: 04 Dec 2014
Total Posts: 297
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
shinxlocke is not online. shinxlocke
Joined: 04 Dec 2014
Total Posts: 297
30 Jun 2015 02:11 PM
bampp..
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image