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: Help plz

Previous Thread :: Next Thread 
JumbledJo1234 is not online. JumbledJo1234
Joined: 02 May 2011
Total Posts: 212
01 Jun 2014 10:25 PM
I'm making an Infected game like the one on COD, and I was wondering how to make a script where it randomly selects someone to carry out an event?
Kinda like the murder mystery games where they select one person to be the murderer
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
01 Jun 2014 10:36 PM
local players = game.Players:GetPlayers()
local randomPlayer = players[math.random(#players)]

You can then refer to the randomPlayer all you want throughout the scope, until the scope with the random player resets, or if it's at the top of the script, and the script re-runs. After that it will just pick a new player.
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