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: check how many children of a model there is?

Previous Thread :: Next Thread 
Elandorr is not online. Elandorr
Joined: 25 Sep 2015
Total Posts: 148
26 Sep 2015 03:33 PM
Simple question
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:38 PM
local function GetChildren(m)
local num
num = #m:GetChildren()
return num
end

just make it recursive
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 03:39 PM
Or #Model:GetChildren() :P
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:41 PM
fish i was trying to break it down for him. plus some lower level languages cant directly except a return value, so you need a variable. its just good practice.
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 03:44 PM
Honestly, it isnt. Why make a function when he can type #Model:GetChildren()

He didnt ask about other programming languages. He asked about RBX.lua
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:46 PM
I was saying that for one I was trying to break it down for him and two that didn't directly pertain to the situation I was saying that I do that for good practice because some lower-level languages do not allow for direct return values.
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:47 PM
also I made it a function in case he needed to use it twice or maybe three or however many times also he couldn't make it recursive easier by the use of a function
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:48 PM
stupid voice recognizer I meant he could make it easier by using a function
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 03:48 PM
So he can just make it a constant
local Children = Model:GetChildren()


Also, 1 line is easier than 4. I am not trying to disprove you, you are right with what you said but it is a lot easier to do this.
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:49 PM
I know and you have a valid point too, I am just saying it's good practice
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 03:50 PM
I think it is good practice to shorten the code plus, it uses less processing power when you use one simple constant.
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:51 PM
no not that I'm saying it's good practice for if you're going to use Lower-level languages to just use a variable because they don't except direct return values a lot of the times
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 03:53 PM
But, he is not using a lower level programming language. He is using lua so it is not really good practice to do it that way.
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:54 PM
it's good practice to know in some cases it won't even work with lua, itll through anerror
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 03:55 PM
It may be good practice to know but it certainly isn't good practice to use that in RBX.lua
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:57 PM
Fish I'm not trying to be rude but you know you're being a bit of a hypocrite I remember when I tried to tell you that you defined variable for child that you only used ones but yet you told me that there was nothing wrong with it and this case it's about the same thing
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 03:57 PM
That was me being lazy
Report Abuse
OrangeKitten is not online. OrangeKitten
Joined: 12 Jul 2007
Total Posts: 383
26 Sep 2015 03:58 PM
lol
Report Abuse
fishguy100 is not online. fishguy100
Joined: 16 Feb 2013
Total Posts: 3679
26 Sep 2015 03:59 PM
Eh, I get lazy too
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