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: Would this work to tele players to a random spawn location?

Previous Thread :: Next Thread 
TheLagScript is not online. TheLagScript
Joined: 13 Apr 2012
Total Posts: 2004
18 Mar 2014 07:08 PM
for _, plrs in pairs(cGame.pInRound) do
for i, spawns in pairs(game.Workspace[cGame.CurrentMap].spawns:GetChildren()) do
plrs.Character:MoveTo(Vector3.new(spawns.Position))
end
end

pretty much i want player1 to teleport to spawn1.
player2 spawn 2, etc.

If the spawns run out for players(e.g: 6 spawns, 7 players, make player 7 go back to spawn 1)

can someone give me an example how to do this? Because I know I am totally wrong.
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
18 Mar 2014 07:12 PM
for i = 1,game.Players.NumPlayers do
for o = 1,#game.Workspace[cGame.CurrentMap].spawns:GetChildren() do
local plr = game.Players:GetPlayers()[i]
plr.Character:MoveTo(Vector3.new(game.Workspace[cGame.CurrentMap].spawns:GetChildren()[o].Position))
end
end

This can be shortened through the use of variables.
Report Abuse
janthran is not online. janthran
Joined: 15 May 2009
Total Posts: 17429
18 Mar 2014 07:28 PM
stop telling people to use numeric for in table iteration
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
18 Mar 2014 07:46 PM
@jan

They both work fine.
Report Abuse
LordDestroyerChaos is not online. LordDestroyerChaos
Joined: 03 Jun 2012
Total Posts: 5742
18 Mar 2014 07:53 PM
Yes, it would.
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