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
 

Re: Table finding a child?

Previous Thread :: Next Thread 
preztonizer is not online. preztonizer
Joined: 22 Oct 2008
Total Posts: 375
13 Feb 2016 11:59 AM
I know i can use getchildren and go through that process. but is there an easier way of getting the children from a child. It sucks i cant just use find first child.


Report Abuse
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
13 Feb 2016 12:01 PM
It depends on what you're trying to do, but if you don't have a specific name you're trying to find GetChildren is the next most popular way.
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
13 Feb 2016 12:18 PM
Nah. Why don't you like GetChildren?

local children = Model:GetChildren()

for i = 1, #children do
if children[i].Name == "NameOfWhatYoureLookingFor" then
print 'found it'
end
end

or

for i,v in pairs(model:GetChildren()) do
if v.Name == "NameOfWhatYoureLookingFor" then
print 'found it'
end
end
Report Abuse
preztonizer is not online. preztonizer
Joined: 22 Oct 2008
Total Posts: 375
13 Feb 2016 12:20 PM
I did. Heres what i got.

local _M = {
players = {}
}

function _M.checktable(tab,what)
for _,i in pairs (tab) do
if i and i == what then
return true
end
end
end


_M.checktable(_M.playing,player)

I get this error

13:19:45.772 - ReplicatedStorage.ServerKick:12: bad argument #1 to 'pairs' (table expected, got nil)


Report Abuse
preztonizer is not online. preztonizer
Joined: 22 Oct 2008
Total Posts: 375
13 Feb 2016 12:29 PM
bump


I am the god. God god god ga-ga-ga-gagad.
Report Abuse
RecurringNightmare is not online. RecurringNightmare
Joined: 05 Jul 2012
Total Posts: 15336
13 Feb 2016 12:36 PM
_M.playing -- are u sure this is a table
Report Abuse
preztonizer is not online. preztonizer
Joined: 22 Oct 2008
Total Posts: 375
13 Feb 2016 12:37 PM
Yes, you can see at at the top, and im able to insert decedents into it with table.insert


I am the god. God god god ga-ga-ga-gagad.
Report Abuse
preztonizer is not online. preztonizer
Joined: 22 Oct 2008
Total Posts: 375
13 Feb 2016 12:46 PM
bump


I am the god. God god god ga-ga-ga-gagad.
Report Abuse
preztonizer is not online. preztonizer
Joined: 22 Oct 2008
Total Posts: 375
13 Feb 2016 12:50 PM
omg. Im sorry i wrote _M.playing when it was _M.players whoops


I am the god. God god god ga-ga-ga-gagad.
Report Abuse
wackeyhd5cool is not online. wackeyhd5cool
Joined: 24 Nov 2010
Total Posts: 906
13 Feb 2016 12:56 PM
Are these meta tables?
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