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: How to make a Teleporter?

Previous Thread :: Next Thread 
plistra is not online. plistra
Joined: 12 Mar 2014
Total Posts: 859
07 Jul 2014 02:54 AM
This is what I have:

~~
local TeleIn = script.Parent
local TeleOut = script.Parent.Parent:FindFirstChild("TeleOut")

TeleIn.Anchored = true

TeleIn.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
local torso = hum.Parent:FindFirstChild("Torso")
wait(2)
torso.Position = Vector3.new(TeleOut.Position)
end
end)
~~

It kills me because it only moves the Torso. Why does it only move the Torso? I thought I read somewhere that if you move the torso, the whole player moves with, is that not true?
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
07 Jul 2014 03:04 AM
It's killing you because instead of moving all of the limbs, it's separating the "Torso" from the others, try using this,
local TeleIn = script.Parent
local TeleOut = script.Parent.Parent:FindFirstChild("TeleOut")

TeleIn.Anchored = true

TeleIn.Touched:connect(function(hit)
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum then
wait(2)
hit.Parent:MoveTo(Vector3.new(TeleOut.Position))
end
end)
More information on the :MoveTo() method can be found here,
http://wiki.roblox.com/index.php?title=MoveTo_%28Method%29
Report Abuse
plistra is not online. plistra
Joined: 12 Mar 2014
Total Posts: 859
07 Jul 2014 03:07 AM
Hmm. It just moves me to the spawn. I guess I'll have to put TeleOut's Vector3 coordinates instead if it's general position.
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
07 Jul 2014 03:08 AM
Contrary to my reply, you can actually just use,
hit.Parent:MoveTo(TeleOut.Position)
when you're using :MoveTo().
Report Abuse
plistra is not online. plistra
Joined: 12 Mar 2014
Total Posts: 859
07 Jul 2014 03:08 AM
I added the coordinates and it works now. Thanks for your help!
Report Abuse
plistra is not online. plistra
Joined: 12 Mar 2014
Total Posts: 859
07 Jul 2014 03:09 AM
That works! Thanks.
PS, how long did it take you to learn that much Lua?
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
07 Jul 2014 03:11 AM
Quite awhile, I still have plenty more to learn though, it's entertaining when you do learn about a new concept and are able to grasp it.
Report Abuse
plistra is not online. plistra
Joined: 12 Mar 2014
Total Posts: 859
07 Jul 2014 03:11 AM
I know. That's why I like Lua. It's simple and easy to learn, yet rewarding when you accomplish stuff.
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