|
| 02 Mar 2015 07:27 AM |
| I need a script that randomly selects 2 players to teleport to to a certain point and prints the names in the output. If you can write a script for me I would greatly appreciate it. |
|
|
| Report Abuse |
|
|
fun4nerd
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 4440 |
|
|
| 02 Mar 2015 07:28 AM |
function getRandomPlayer() local players = game.Players:GetPlayers() return players[math.random(#players)]
end |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 07:31 AM |
But how to teleport the players. Would it be wise to use vector3?
|
|
|
| Report Abuse |
|
|
| |
|
fun4nerd
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 4440 |
|
|
| 02 Mar 2015 07:35 AM |
1 sec! -- this does teleport 1 player
function getRandomPlayer() local players = game.Players:GetPlayers() local player = players[math.random(#players)] player.Character.Torso.Position = Vector3.new(0, 50, 0) print(player.Character.Name) end |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 07:36 AM |
local target = CFrame.new(0,0,0)--location for i, player in ipairs(game.Players:GetChildren()) do if player.Character and player.Character:findFirstChild("Torso") then player.Character.Torso.CFrame = target end
(ಠ_ಠ)┌∩┐ |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 07:37 AM |
Forgot an end
local target = CFrame.new(70.6, 0.5, 42.6)--location for i, player in ipairs(game.Players:GetChildren()) do if player.Character and player.Character:findFirstChild("Torso") then player.Character.Torso.CFrame = target + Vector3.new(0, i * 5, 0) end end
(ಠ_ಠ)┌∩┐ |
|
|
| Report Abuse |
|
|
fun4nerd
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 4440 |
|
|
| 02 Mar 2015 07:38 AM |
| /\ person above teleports all players! |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 07:39 AM |
| I'm gonna try yours fun4nerd. I think it will work better. I also don't trust the other guy. |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 07:40 AM |
| Especially when he does (ಠ_ಠ)┌∩┐all the time. its real mature. |
|
|
| Report Abuse |
|
|
fun4nerd
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 4440 |
|
|
| 02 Mar 2015 07:40 AM |
| @sloppy his script just teleports all players! |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 07:42 AM |
I just tested the script, it doesn't work :(
do I need 2 players online? |
|
|
| Report Abuse |
|
|
|
| 02 Mar 2015 07:46 AM |
In fact it only does 1.
(ಠ_ಠ)┌∩┐ |
|
|
| Report Abuse |
|
|
fun4nerd
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 4440 |
|
|
| 02 Mar 2015 07:46 AM |
@sloppy no u just need to call the function twice!
function getRandomPlayer() local players = game.Players:GetPlayers() local player = players[math.random(#players)] player.Character.Torso.Position = Vector3.new(0, 50, 0) end |
|
|
| Report Abuse |
|
|
| |
|
|
| 02 Mar 2015 07:49 AM |
function getRandomPlayer() local players = game.Players:GetPlayers() local player = players[math.random(#players)] player.Character.Torso.Position = Vector3.new(0, 50, 0) end getRandomPlayer()
Fixed
( ͠° ͟ʖ ͡°) |
|
|
| Report Abuse |
|
|
fun4nerd
|
  |
| Joined: 30 Oct 2013 |
| Total Posts: 4440 |
|
|
| 02 Mar 2015 10:26 AM |
| @above i thought he could call a function but he dont know a thing about scripts! |
|
|
| Report Abuse |
|
|