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: Trying to get this Teleport thing to work...

Previous Thread :: Next Thread 
brickbuilder74 is not online. brickbuilder74
Joined: 23 Jun 2008
Total Posts: 8810
21 Sep 2011 06:02 PM
Here's my piece of code, but it doesn't work. When my script gets here, it just stops.

for _,v in pairs (game.Players:GetChildren()) do
pcall(function()
v.Character:MoveTo(math.random(2,#newMap.ASpawn))
end)
end
Report Abuse
ShoeBox4 is not online. ShoeBox4
Joined: 06 Apr 2011
Total Posts: 890
21 Sep 2011 06:03 PM
for _,v in pairs (game.Players:GetChildren()) do
pcall(function()
v.Character:MoveTo(math.random(2,#newMap.ASpawn))
end)

I don't see a reason for a second end O_O
Report Abuse
brickbuilder74 is not online. brickbuilder74
Joined: 23 Jun 2008
Total Posts: 8810
21 Sep 2011 06:04 PM
The second end is for the "for _,v in pairs" thing. *facepalm*
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
21 Sep 2011 06:05 PM
for _,v in pairs(game.Players:GetChildren()) do
v.Character:MoveTo(Vector3 coordinates)
end
Report Abuse
brickbuilder74 is not online. brickbuilder74
Joined: 23 Jun 2008
Total Posts: 8810
21 Sep 2011 06:07 PM
@Grimm - For one, that doesn't move the character to one of the random set spawns, and for two, WAY too much work to send to a coordinate...
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
21 Sep 2011 06:09 PM
Well, last time I checked, :MoveTo() works only with Vector3 coordinates.
Am I wrong? :o
Report Abuse
brickbuilder74 is not online. brickbuilder74
Joined: 23 Jun 2008
Total Posts: 8810
21 Sep 2011 06:09 PM
I'm pretty sure that you can move to a brick.
Report Abuse
grimm343 is not online. grimm343
Joined: 18 Sep 2008
Total Posts: 2796
21 Sep 2011 06:10 PM
You move it to a brick's position, which would return its Vector3 coordinates.
Report Abuse
GoldenUrg is not online. GoldenUrg
Joined: 23 Aug 2009
Total Posts: 6428
21 Sep 2011 06:39 PM
You're random seems to imply you have a table of positions:

for _,v in pairs (game.Players:GetChildren()) do
pcall(function()
v.Character:MoveTo(newMap.ASpawn[math.random(2,#newMap.ASpawn)])
end)
end
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