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: I am New When it Comes to Tables...

Previous Thread :: Next Thread 
ScottHolt02 is not online. ScottHolt02
Joined: 12 Dec 2014
Total Posts: 2435
22 Jul 2015 05:22 PM
I want to know how to put players in a tables and have it randomly select a player. Can someone give me an example so it would print the chosen player's name?

local players = {}

for i,v --I forgot what's next. T.T
Report Abuse
DerpyMerpKing is not online. DerpyMerpKing
Joined: 05 Feb 2011
Total Posts: 2553
22 Jul 2015 05:23 PM
dont use table u dont need to
if siggy == false then print"nooo :(" end
Report Abuse
ScottHolt02 is not online. ScottHolt02
Joined: 12 Dec 2014
Total Posts: 2435
22 Jul 2015 05:24 PM
Then how do I randomly choose a player?
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
22 Jul 2015 05:25 PM
Try:
http://www.roblox.com/Forum/ShowPost.aspx?PostID=162704485 http://www.roblox.com/Forum/ShowPost.aspx?PostID=162741821

Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
Report Abuse
ScottHolt02 is not online. ScottHolt02
Joined: 12 Dec 2014
Total Posts: 2435
22 Jul 2015 05:27 PM
Wow, I can really learn from this!
Report Abuse
fret13103 is not online. fret13103
Joined: 15 Mar 2010
Total Posts: 881
22 Jul 2015 05:27 PM
local Players = game.Players:GetChildren()
local rand = math.random(1, #Players)

wait()

local ChosenPlayer = Players[rand]

Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
22 Jul 2015 05:57 PM
@fret

local players = game.Players:GetPlayers()
local ranPlayer = players[math.random(1,#players)]
print(ranPlayer.Name)


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
22 Jul 2015 06:00 PM
local table = require(199207348)

local plr = table.random(game.Players:GetPlayers()) --plr is the random player
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