|
| 23 Aug 2012 10:14 AM |
| How would i grab 1 random person and teleport him her/him to a certain location? |
|
|
| Report Abuse |
|
Stealthah
|
  |
| Joined: 18 Aug 2012 |
| Total Posts: 288 |
|
| |
BAUER102
|
  |
| Joined: 03 Apr 2010 |
| Total Posts: 5936 |
|
|
| 23 Aug 2012 10:38 AM |
The script should look like this:
- Get a table of all players - Use math.random to choose one - Check, if his character does exist - If yes, then teleport him
And since I'm in such a good mood I'll write the script for you, too.
local Position = Vector3.new(0,10,0) -- You obviously need to change the position
function TeleportRandom() -- Get the table of all players local players = game:GetService("Players"):GetPlayers() -- Choose one local chosen = players[math.random(1,#players)] -- Does his character exists? We don't want to cause an error. if (chosen.Character==nil) then return end -- Does his torso exists? if (chosen.Character:FindFirstChild("Torso")==nil) then return end -- MoveTo() is useful for this. chosen.Character:MoveTo(Position) end
Feel free to ask, if you don't understand something of it. |
|
|
| Report Abuse |
|