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
 

Re: Would this line of code choose a random player?

Previous Thread :: Next Thread 
Xsysix is not online. Xsysix
Joined: 29 Mar 2014
Total Posts: 1182
08 Jun 2014 02:58 PM
local Plr = game.Players:GetChildren()[math.random(game.Players.NumPlayers)]

Would this choose a random player?

- Add 1.5k | Deplexity | its a lego men game stop worrying
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jun 2014 02:59 PM
Yes
Report Abuse
Xsysix is not online. Xsysix
Joined: 29 Mar 2014
Total Posts: 1182
08 Jun 2014 02:59 PM
Awesome

- Add 1.5k | Deplexity | its a lego men game stop worrying
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
08 Jun 2014 03:01 PM
no it should error or do nothing, unless roblox changed.

it should be 1,game.Players.NumPlayers
Report Abuse
sonicdiablo is not online. sonicdiablo
Joined: 05 Feb 2009
Total Posts: 1661
08 Jun 2014 03:03 PM
His line is perfectly fine.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jun 2014 03:05 PM
Roblox was never changed. Learn how tables work:
http://lua-users.org/wiki/TablesTutorial
Report Abuse
BladeXE is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
08 Jun 2014 03:06 PM
How he did it does work, but most people prefer 1, game.Players.NumPlayers for random players
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
08 Jun 2014 03:34 PM
Actually, many times in the past I've tried things such as this; ex. math.random(5)- and it did not work.
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
08 Jun 2014 03:35 PM
math.random with one argument works just fine.

Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
08 Jun 2014 03:38 PM
cr, it always worked fine.
You probably did something like math.random(5, 0) or something
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
08 Jun 2014 04:52 PM
Ehh, probably. Cnt, can you help me with something? For someone it has 73 views but no responds.. http://www.roblox.com/Forum/ShowPost.aspx?PostID=136404661
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