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: I need to make a random person choosing script

Previous Thread :: Next Thread 
freedomfighters is not online. freedomfighters
Joined: 16 Jul 2008
Total Posts: 5
11 Aug 2010 10:28 PM
I am brand new to scripting and I haveent even read the whole tutorial. I was thinking it would go something like this
game.Workspace.Players.:chooserandom()
Is that ANYTHING like what it would look like?
Report Abuse
bosox5 is not online. bosox5
Joined: 25 Jun 2009
Total Posts: 908
11 Aug 2010 10:29 PM
Sort of... I guess... Its gonna be longer than that tho.
Report Abuse
harutsedo is not online. harutsedo
Joined: 11 Oct 2009
Total Posts: 5150
11 Aug 2010 10:29 PM
No.

player=game.Players:GetChildren()[math.random(1,game.Players.NumPlayers)]
Report Abuse
DidYouSeeThatDog is not online. DidYouSeeThatDog
Joined: 08 Jul 2010
Total Posts: 2039
11 Aug 2010 10:31 PM
Okay, say both you and I were in a random game, and this scrit was ran.

function getRandomPlayer()
x = game.Players:GetChildren()
return x[math.random(1,#x)]
end

print(getRandomPlayer().Name)
print(getRandomPlayer().Name)
print(getRandomPlayer().Name)
>DidYouSeeThatDog
>freedomfighters
>freedomfighters

the function getRandomPlayer(), returns a random player :3

so you could use this aswell :P
getrandomPlayer().Character:BreakJoints()
Report Abuse
freedomfighters is not online. freedomfighters
Joined: 16 Jul 2008
Total Posts: 5
11 Aug 2010 10:36 PM
@DidYouSeeThatDog
With BreakJoints() at the end, what would that do to help?
What if I wanted to teleport everyone else to a certain location but the person randomly selected. Then teleport the selected player to the location the other players were teleported.
Report Abuse
DidYouSeeThatDog is not online. DidYouSeeThatDog
Joined: 08 Jul 2010
Total Posts: 2039
11 Aug 2010 10:42 PM
BreakJoints() will kill humanoids if they are children of something that has its joints broken.


function getRandomPlayer()
x = game.Players:GetChildren()
return x[math.random(1,#x)]
end

x = getRandomPlayer() --gets the special person who wont be tele'd
y = game.Players:GetChildren()
l = Vector3.new(math.random(-256,256),10,math.random(-256,256))) -- makes the teleport point
for i=1,#y do
if y[i] ~= x then
y[i].Character:MoveTo(l) --moves everyone to the teleport point
end
end

wait(5)

x.Character:MoveTo(l) -- moves the special person to the teleport point

Its been a while so I cant remember if MoveTo() works that way, anyway, do you understand that ?
Report Abuse
freedomfighters is not online. freedomfighters
Joined: 16 Jul 2008
Total Posts: 5
11 Aug 2010 10:47 PM
Barely
Report Abuse
OBF is not online. OBF
Joined: 29 Sep 2009
Total Posts: 10709
11 Aug 2010 10:47 PM
@Did
BreakJoints removes welds. Without a neck weld, we die, explaining why BreakJoints kills.
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