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 » Scripters
Home Search
 

Re: I need help with something

Previous Thread :: Next Thread 
Twinmill42 is not online. Twinmill42
Joined: 04 Jun 2012
Total Posts: 16785
18 Nov 2014 11:12 PM
I want to make a script where when a player touches a certain brick, that brick will teleport them.

How would I do this?
Report Abuse
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
18 Nov 2014 11:22 PM
teleportTo = Vector3.new(x,y,z) -- Put the location you want to
local buttonPressed = false
--Store whether the button is pressed in a local variable

script.Parent.Touched:connect(function(hit)
if not buttonPressed then
-- Is it not pressed?
buttonPressed = true
-- Mark it as pressed, so that other handlers don't execute

print("Button pressed")
wait(1)
pcall(function() hit.Parent.Torso.Position = teleportTo end)
-- Do Stuff
buttonPressed = false
-- Mark it as not pressed, so other handlers can execute again
end
end)
Report Abuse
IDKTycoons is not online. IDKTycoons
Joined: 05 Apr 2013
Total Posts: 18
18 Nov 2014 11:25 PM
one or two way tele?
Report Abuse
Twinmill42 is not online. Twinmill42
Joined: 04 Jun 2012
Total Posts: 16785
18 Nov 2014 11:28 PM
Local variable?
Report Abuse
Twinmill42 is not online. Twinmill42
Joined: 04 Jun 2012
Total Posts: 16785
18 Nov 2014 11:30 PM
@Tycoons

1 way
Report Abuse
Twinmill42 is not online. Twinmill42
Joined: 04 Jun 2012
Total Posts: 16785
18 Nov 2014 11:37 PM
@ninja

nevermind about local variables, but it kills me when I teleport?
Report Abuse
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
18 Nov 2014 11:39 PM
Does only your torso go to where you teleport? Because that would be hilarious. Output?
Report Abuse
Twinmill42 is not online. Twinmill42
Joined: 04 Jun 2012
Total Posts: 16785
18 Nov 2014 11:41 PM
yep it's only the torso

and in output it just says "Button pressed"
Report Abuse
SethDusek5 is not online. SethDusek5
Joined: 26 Mar 2011
Total Posts: 2580
18 Nov 2014 11:48 PM
teleportTo = Vector3.new(x,y,z) -- Put the location you want to
local buttonPressed = false
--Store whether the button is pressed in a local variable

script.Parent.Touched:connect(function(hit)
if not buttonPressed then
-- Is it not pressed?
buttonPressed = true
-- Mark it as pressed, so that other handlers don't execute

print("Button pressed")
wait(1)
pcall(function() hit.Parent:MoveTo(teleportTo) end)
-- Do Stuff
buttonPressed = false
-- Mark it as not pressed, so other handlers can execute again
end
end)
Report Abuse
Twinmill42 is not online. Twinmill42
Joined: 04 Jun 2012
Total Posts: 16785
18 Nov 2014 11:52 PM
thanks Seth
Report Abuse
SethDusek5 is not online. SethDusek5
Joined: 26 Mar 2011
Total Posts: 2580
18 Nov 2014 11:55 PM
what the other guy was doing wrong was, setting position, which will only move said block, not everything attached to it. You could use .CFrame or :MoveTo() on the model.
Report Abuse
Twinmill42 is not online. Twinmill42
Joined: 04 Jun 2012
Total Posts: 16785
18 Nov 2014 11:57 PM
Ohhhhhhh
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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