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
|
  |
| Joined: 12 Jan 2013 |
| Total Posts: 504 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 12 Jan 2013 |
| Total Posts: 504 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 12 Jan 2013 |
| Total Posts: 504 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 12 Jan 2013 |
| Total Posts: 504 |
|
| |
|
Dollar500
|
  |
| Joined: 12 Jan 2013 |
| Total Posts: 504 |
|
| |
|