I’m trying to have the player teleport infront of the “MouseTarget” AND have the player look towards the “MouseTarget” but it isn’t working.
print(MouseTarget.LowerTorso.Orientation - Vector3.new(0, 180, 0))
player.Character.HumanoidRootPart.Orientation = Vector3.new(0, 180, 0)
player.Character.HumanoidRootPart.Anchored = true
MouseTarget.HumanoidRootPart.Anchored = true
MouseTarget.HumanoidRootPart.Position = MouseTarget.HumanoidRootPart.Position
player.Character:SetPrimaryPartCFrame(MouseTarget:GetPrimaryPartCFrame()*CFrame.new(0, 0, -4))
Skainted
(IMissMyKids)
May 5, 2024, 7:48pm
#2
have you tried using cframe.angles instead? (make sure to use math.rad)
since orientation, is based off of world positions, and angles is based off cframe.
J_Angry
(J_Angry)
May 5, 2024, 7:55pm
#3
Try using CFrame.lookAt. This code might work:
local CharHRP = player.Character:FindFirstChild("HumanoidRootPart")
local MTHRP = MouseTarget:FindFirstChild("HumanoidRootPart")
CharHRP.CFrame = CFrame.lookAt(CharHRP.Position, Vector3.new(MTHRP.Position.X, CharHRP.Position.Y, MTHRP.Position.Z))
1 Like
J_Angry his answer worked combined with teleporting the player before making the player face the right direction
system
(system)
Closed
May 19, 2024, 8:37pm
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.