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 » Scripting Helpers
Home Search
 

would this work

Previous Thread :: Next Thread 
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
24 Feb 2014 10:29 PM
local rando = math.random(1, #game.Lighting.Maps:GetChildren())

local cloon = game.Lighting.Maps:findfirstchild("MapNumber"..rando..):clone()
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
24 Feb 2014 10:32 PM
It would, however, if I were to make it, I would directly make it into

local cloon = game.Lighting.Maps["MapNumber"..math.random(1, #game.Lighting.Maps:GetChildren())]:Clone()
Report Abuse
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
24 Feb 2014 10:33 PM
Silly me. Why did I even use the findfirstchild method anyway?
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
24 Feb 2014 10:35 PM
Hahaha, when I first started, I used to do findFirstChild(except in error checking), but I do not anymore, because I don't see any practical usage for anymore. An example would be in this. If the child is nil, using findFirstChild or indexing would error in any way because of the :Clone().
Report Abuse
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
24 Feb 2014 10:38 PM
Yeah, findfirstchild returns a bool for if it is not nil. Ty
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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