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: Help

Previous Thread :: Next Thread 
djwill619 is not online. djwill619
Joined: 13 Jun 2011
Total Posts: 756
21 Mar 2014 02:38 PM
How Would I Move All The Players To Different Positions?
I Know How To Use :MoveTo()
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Mar 2014 02:40 PM
Loop through the players service.

for Index, Player in pairs(Game:GetService("Players"):GetPlayers()) do
if Player.Character then
Player.Character:MoveTo(Vector3.new(0, 0, 0)) --Position here
end
end

Report Abuse
djwill619 is not online. djwill619
Joined: 13 Jun 2011
Total Posts: 756
21 Mar 2014 02:44 PM
How Would I Do That For Every Player?
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
21 Mar 2014 02:45 PM
Im pretty sure thats for all players ^
Report Abuse
djwill619 is not online. djwill619
Joined: 13 Jun 2011
Total Posts: 756
21 Mar 2014 02:53 PM
Indiviualy, like teleport 1 player to 0,0,0 and another to 3,3,3
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
21 Mar 2014 03:15 PM
If you want to teleport each player to a different spot, you have to do it individually.

If you are teleporting them to a map, you can put part locations in a table and remove them once a player gets teleported to it (so two players don't go to the same location). For example, let's say you want to teleport players to a sword fighting arena, but you don't want two players to go to the same spot:

local teleport_parts = {}
}

--initialize the teleport parts, add them to a table if they are named "tpPart"
for i, v in pairs(Workspace.Map:GetChildren()) do
if v.Name == "tpPart" then
table.insert(teleport_parts, v.Position)
end
end

--now teleport each player to a tpPart
local players = game.Players:GetPlayers()
for i, v in pairs(teleport_parts) do
players[i]:MoveTo(Vector3.new(v))
end

--clear the teleport_parts table
teleport_parts = {}
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
21 Mar 2014 03:16 PM
Oops, I made a typo. Here it is fixed:

local teleport_parts = {}
}

--initialize the teleport parts, add them to a table if they are named "tpPart"
for i, v in pairs(Workspace.Map:GetChildren()) do
if v.Name == "tpPart" then
table.insert(teleport_parts, v.Position)
end
end

--now teleport each player to a tpPart
local players = game.Players:GetPlayers()
for i, v in pairs(teleport_parts) do
players[i].Character:MoveTo(Vector3.new(v))
end

--clear the teleport_parts table
teleport_parts = {}
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
21 Mar 2014 07:48 PM
That would only teleport the amount of people there are 'tpPart's. He can simply group the spawns into a model and do something like:

local Spawns = Workspace.Spawns:GetChildren()
for Index, Player in pairs(Game:GetService("Players"):GetPlayers()) do
if Player.Character then
Player.Character:MoveTo(Spawns[math.random(#Spawns)])
end
end
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
21 Mar 2014 07:52 PM
c = game.Players:GetChildren()
for i = 1,#c do
c[i].Character.Torso.CFrame = CFrame.new(x,y,z)
end

or

for i,v in piars(game.Players:GetChildren()) do
v.Character.Torso.CFrame = CFrame.new(x,y,z)
end
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
21 Mar 2014 07:56 PM
Or...


A = -3
B = -3
C = -3
Players = game.Players:GetPlayers()
for I = 1,#Players do
A = A + 3
B = B + 3
C = C + 3
Players[I].Character:MoveTo(A, B, C)
end


I mean. Seriously...
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