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: stupid question

Previous Thread :: Next Thread 
GreedTaka is not online. GreedTaka
Joined: 12 Dec 2014
Total Posts: 1503
19 Dec 2016 07:59 AM
if t:GetChildren() ==0 then
why wont this work
Report Abuse
Rerumu is not online. Rerumu
Joined: 11 Oct 2014
Total Posts: 950
19 Dec 2016 08:00 AM
Put a # before the t, the # operator gets the length of an array or string.
Report Abuse
8BitRetroGamer is not online. 8BitRetroGamer
Joined: 09 Mar 2013
Total Posts: 3546
19 Dec 2016 08:07 AM
You're trying to set a value to a function. Simply put, in the case of the function GetChildren, this won't work.

If you're trying to check if children exist in parent "t", I think this should suffice:

Children = t:GetChildren()
if Children then

end
Report Abuse
Rerumu is not online. Rerumu
Joined: 11 Oct 2014
Total Posts: 950
19 Dec 2016 08:08 AM
What are you on?
Lol that's so wrong it gave me a tumour.
Report Abuse
HlCOM is not online. HlCOM
Joined: 29 Mar 2009
Total Posts: 3332
19 Dec 2016 08:08 AM
Put a # before the t, the # operator gets the length of an array or string.[2]

if #thing:GetChildren() == 1 then
print('thing has 1 child')
end
Report Abuse
8BitRetroGamer is not online. 8BitRetroGamer
Joined: 09 Mar 2013
Total Posts: 3546
19 Dec 2016 08:15 AM
I tried it, it worked for me, so I posted it. If you think it's wrong, then you can say why, without throwing insults.
Report Abuse
Rerumu is not online. Rerumu
Joined: 11 Oct 2014
Total Posts: 950
19 Dec 2016 08:18 AM
Because no matter the amount of children in an object, GetChildren() will return an array. And array is ALWAYS regarded as "true" in if statements.
Report Abuse
8BitRetroGamer is not online. 8BitRetroGamer
Joined: 09 Mar 2013
Total Posts: 3546
19 Dec 2016 08:19 AM
Thanks, I understand now. That's better.
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