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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: I need a script

Previous Thread :: Next Thread 
sloppylego87 is not online. sloppylego87
Joined: 25 Mar 2011
Total Posts: 326
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 is not online. 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
sloppylego87 is not online. sloppylego87
Joined: 25 Mar 2011
Total Posts: 326
02 Mar 2015 07:31 AM
But how to teleport the players. Would it be wise to use vector3?
Report Abuse
sloppylego87 is not online. sloppylego87
Joined: 25 Mar 2011
Total Posts: 326
02 Mar 2015 07:34 AM
Bump
Report Abuse
fun4nerd is not online. 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
UnlimitedKoradoxic is not online. UnlimitedKoradoxic
Joined: 14 Jul 2011
Total Posts: 452
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
UnlimitedKoradoxic is not online. UnlimitedKoradoxic
Joined: 14 Jul 2011
Total Posts: 452
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 is not online. fun4nerd
Joined: 30 Oct 2013
Total Posts: 4440
02 Mar 2015 07:38 AM
/\ person above teleports all players!
Report Abuse
sloppylego87 is not online. sloppylego87
Joined: 25 Mar 2011
Total Posts: 326
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
sloppylego87 is not online. sloppylego87
Joined: 25 Mar 2011
Total Posts: 326
02 Mar 2015 07:40 AM
Especially when he does (ಠ_ಠ)┌∩┐all the time. its real mature.
Report Abuse
fun4nerd is not online. fun4nerd
Joined: 30 Oct 2013
Total Posts: 4440
02 Mar 2015 07:40 AM
@sloppy his script just teleports all players!
Report Abuse
sloppylego87 is not online. sloppylego87
Joined: 25 Mar 2011
Total Posts: 326
02 Mar 2015 07:42 AM
I just tested the script, it doesn't work :(

do I need 2 players online?
Report Abuse
UnlimitedKoradoxic is not online. UnlimitedKoradoxic
Joined: 14 Jul 2011
Total Posts: 452
02 Mar 2015 07:46 AM
In fact it only does 1.

(ಠ_ಠ)┌∩┐
Report Abuse
fun4nerd is not online. 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
UnlimitedKoradoxic is not online. UnlimitedKoradoxic
Joined: 14 Jul 2011
Total Posts: 452
02 Mar 2015 07:48 AM

( ͠° ͟ʖ ͡°)
Report Abuse
UnlimitedKoradoxic is not online. UnlimitedKoradoxic
Joined: 14 Jul 2011
Total Posts: 452
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 is not online. 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
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