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: Teleport in front of brick

Previous Thread :: Next Thread 
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 12:03 AM
I want to be able to touch the brick and be teleported to the other side of the brick. I got it to work, but only from one angle and it teleports me really far in front of the brick. This is what I have. How can I fix it?

script.Parent.Touched:connect(function(Hit)
if Hit.Parent then
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
if Humanoid then
local Torso = Hit.Parent:FindFirstChild("HumanoidRootPart")
Torso.CFrame = Torso.CFrame + Vector3.new(script.Parent.Size.X, 0, 0) *
(Torso.CFrame.lookVector).unit
end
end
end)
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 01:09 AM
B1
Report Abuse
PLBH is not online. PLBH
Joined: 08 May 2014
Total Posts: 151
23 Jul 2017 01:13 AM
I would divide the script.parent.size.x to fix u teleporting far and look use CFrame.Rotation
Report Abuse
Bobbrige is not online. Bobbrige
Joined: 27 Jul 2010
Total Posts: 411
23 Jul 2017 01:15 AM
make two conditionals that handle touching either side of the brick


local wallX = script.Parent.Position.X
local myX = Torso.Position.X
if myX > wallX then
Torso.CFrame = Torso.CFrame + Vector3.new(-script.Parent.Size.X,0,0)
end
if myX < wallX then
Torso.CFrame = Torso.CFrame + Vector3.new(script.Parent.Size.X,0,0)
end

or something
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 02:07 AM
PLBH, what do you mean when you say use CFrame Rotation?
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 09:29 AM
B
Report Abuse
PLBH is not online. PLBH
Joined: 08 May 2014
Total Posts: 151
23 Jul 2017 10:40 AM
something like this

Torso.CFrame = CFrame.new(Torso.Position, Vector3.new(0, 75, 75))
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 11:33 AM
That just rotates the character...

What I am trying to do is to be able to teleport the character past walls and it doesn't matter what angle the character comes at it
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 01:41 PM
Also, I want it to teleport right in front on the other of the brick
Report Abuse
doggy00 is online. doggy00
Joined: 11 Jan 2011
Total Posts: 3571
23 Jul 2017 01:45 PM
Can you be more specific? I don't exactly see what you're requesting here.
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 02:29 PM
So, lets say I have a wall that has CanCollide to false. When I walk in a straight line, I go through the part to the other side. In my case, though, I have CanCollide to true. So, what I want to do is that when the player touches the part, they get teleported to the other side of the wall as if they had just walked through it... I hope that makes sense
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 04:01 PM
B2
Report Abuse
ahwz is not online. ahwz
Joined: 01 Apr 2010
Total Posts: 3230
23 Jul 2017 04:13 PM


local function moveToFront(character,part)
local hrp,cf=character.PrimaryPart,part.CFrame
hrp.CFrame=cf+cf.lookVector.unit*part.Size.Z/2
end




Report Abuse
ahwz is not online. ahwz
Joined: 01 Apr 2010
Total Posts: 3230
23 Jul 2017 04:17 PM
Mine make it so it is infront of the ACTUAL front of the part.

You might have to use like rightVector,upVector or any negative values of these to get the desired location needed.

Also Positive Z axis is for the positive lookVector. You will have to change those around as well.

No one takes where the actual lookVector into consideration when building. No one should have to so thats why you gotta use it situational.


Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 05:27 PM
What do you mean "nobody takes lookVector into consideration"?
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 07:07 PM
Would this work?

local Level = Vector3.new(script.Parent.Position.X, Torso.Position.Y, script.Parent.Position.Z)
local Direction = (Level - Torso.Position)
Torso.CFrame = CFrame.new(script.Parent.Position, Torso.Orientation) + (Direction)
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
23 Jul 2017 07:08 PM
I can't get to a computer
Report Abuse
Dollar500 is not online. Dollar500
Joined: 12 Jan 2013
Total Posts: 504
24 Jul 2017 12:56 AM
B
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