I'm trying to make an ability akin to Shadow Step from WoW, where upon clicking on a valid target(another player) the user would be teleported behind the target facing the target's back.
I've tried countless variations of Vector3 and CFrame but alas to no avail. This is inside LocalScript, tho i'm starting suspect that figuring out which way the target is facing is impossible client so, so i tried serverside, still no luck, so i tried creating a part infront of the target and making a vector from the target torso to the part but that was a disaster
This script works in that it teleports the player behind the target more or less, however rotating the player to face the target has proved impossible for me atm. Also I know that if i want to both move and rotate target i shouldn't use :MoveTo but it's the only thing i've been able to make work so far
Any advice will be much appriciated as i suspect even this working script can be improved
tool.Activated:Connect(function(part)
if Debounce then return end
Debounce = true
local MHP = mouse.Hit.Position
local ray = Ray.new(Character.HumanoidRootPart.CFrame.p,
(MHP - Character.HumanoidRootPart.CFrame.p).unit * 50)
local part, position = workspace:FindPartOnRay(ray, Player.Character, false, true)
if part and part.Parent:FindFirstChild("Humanoid") then
local target = part.Position
local Orientation = part.CFrame.lookVector * (3)
local landing = (target - Orientation)
if part.Parent.Humanoid.Health > 0 then
Character:MoveTo(landing)
end
end
wait (1)
Debounce = false
end)

3 comments
use -CFrame.LookVector on the 'enemy' HRP to teleport behind them, and then face the players HRP using (P1-P2).Unit
not sure i did it quite as you instructed but it works, expect now i have a different issue, when the cursor is lockedOn with shift it overrides my rotation of the player
either way post your comment as a question i'll accept it as an answer