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: math.random

Previous Thread :: Next Thread 
Emperoar is not online. Emperoar
Joined: 06 Aug 2010
Total Posts: 382
13 Sep 2015 02:48 PM
pos1 = 1
pos2 = 2
pos3 = 3
pos4 = 4

How would I have all the players in the game teleported randomly to any of these locations from a localscript in the StarterPlayerScripts?





~Emperoar~
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
13 Sep 2015 02:55 PM
math.random(1,4)
#code return
Report Abuse
Emperoar is not online. Emperoar
Joined: 06 Aug 2010
Total Posts: 382
13 Sep 2015 03:04 PM
i tried

for i = 1, #1player (math.random(1,4))

if i == 1 then
(teleport to pos1)
end

etc.

but that didn't work...


~Emperoar~
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
13 Sep 2015 03:07 PM
local tab = {{1,2,3},{1,2,3}}

local p = tab[math.random(#tab)]
local pos = Vector3.new(p[1],p[2],p[3])
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