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: Teleport bricks script help

Previous Thread :: Next Thread 
DukeCow is not online. DukeCow
Joined: 20 Nov 2010
Total Posts: 13176
01 Aug 2014 10:08 PM
I made 2 bricks, green and red. When you touch on let's say the green one, it'd teleport you to the position of the red one, but 5 studs up. Green and red are in a model, this script is inside of green
script.Parent.Touched:connect(function(hit)
local hum = hit.Parent:findFirstChild("Humanoid")
if hum ~= nil then
hit.Parent.Position = Vector3.new(script.Parent.Parent.red.Position.X, script.Parent.Parent.red.Position.Y + 5, script.Parent.Parent.red.Position.Z)
end
end)
Report Abuse
Tauritaar is not online. Tauritaar
Joined: 30 Dec 2012
Total Posts: 1785
01 Aug 2014 10:16 PM
Your situation is great exercise for my mind. Thank you.

--SCRIPT--


local red = script.Parent.Parent.Red
local green = script.Parent
local model = script.Parent.Parent

function onTouch(hit)
local human = hit.Parent.Humanoid
human.Parent:findFirstChild("Torso").Position = red.Position.x, red.Position.y + 5, red.Position.z
end

function onTouch(hit2)
human.Parent:findFirstChild("Torso").Position = green.Position.x, green.Position.y + 5, green.Position.z
end

script.Parent.Touched:connect(onTouch)
script.Parent.Parent.Red.Touched:connect(onTouch)
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