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 » Roblox » Help (Technical Support and Account Issues)
Home Search
 

Pick RandomTwo

Previous Thread :: Next Thread 
BlazerTheObserver is not online. BlazerTheObserver
Joined: 30 May 2012
Total Posts: 65
03 May 2015 10:35 AM
Here is a script that I scripted awhile back, i'm wondering why it doesn't seem to work...
function pickRandomTwo()
if game.Players.NumPlayers >= 2 then
local r1 = game.Players:GetChildren()[math.random(1,#game.Players:GetPlayers())]
if r1 ~= nil then
local randomPlayer1 = r1
end
repeat
local r2 = game.Players:GetChildren()[math.random(1,#game.Players:GetPlayers())]
until r1 ~= r2
if r1 ~= randomPlayer2 and randomPlayer1 ~= nil then
local randomPlayer2 = r2
end
end
end

function gameStart()
pickRandomTwo()
if randomPlayer1 ~= nil and randomPlayer2 ~= nil then
local Player1 = game.Players:FindFirstChild(randomPlayer1.Name)
local Player2 = game.Players:FindFirstChild(randomPlayer2.Name)
if Player1 ~= nil and Player2 ~= nil then
randomPlayer1 = Player1
randomPlayer2 = Player2

randomPlayer1:MoveTo(Vector3.new(20.3, 6.09, -10.5))
randomPlayer2:MoveTo(Vector3.new(-52.4, 6.09, -10.5))

end
end
end
Report Abuse
Exail is not online. Exail
Joined: 08 Jan 2010
Total Posts: 13355
03 May 2015 10:47 AM
Hello, BlazertheObserver! I am sorry to see you're in need of help, I wouldn't suggest posting it here, instead.. you should post it in the Scripting Section!

MY PRAISING IS INTENSIFYING OF THE SUN.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Roblox » Help (Technical Support and Account Issues)
   
 
   
  • 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