How do I make it so when my player tps behind another player it doesn’t align their orientation with that player that i tped behind?
NOTE: I’m using CFrame.Position. I’m just so confused why it’s still rotating my character with the player i’m tping behind.
local rootorigin = root.CFrame
local targetposition = troot.CFrame + CFrame.new(rootorigin.Position, troot.Position).LookVector * 10
targetposition = CFrame.new(targetposition.Position)
local params = RaycastParams.new()
params.FilterDescendantsInstances = {game.Workspace.Alive, game.Workspace.Visuals}
local cast = workspace:Raycast(rootorigin.Position, targetposition.Position, params)
if cast and cast.Instance then
targetposition = CFrame.new(cast.Position).Position
end
character:PivotTo(targetposition)
local rootorigin = root.CFrame
local targetposition = troot.CFrame + CFrame.new(rootorigin.Position, troot.Position).LookVector * 10
local targetcframe = CFrame.new(targetposition.Position) * rootorigin.Rotation
local params = RaycastParams.new()
params.FilterDescendantsInstances = {game.Workspace.Alive, game.Workspace.Visuals}
local cast = workspace:Raycast(rootorigin.Position, targetposition.Position, params)
if cast and cast.Instance then
targetcframe = CFrame.new(cast.Position) * rootorigin.Rotation
end
character:PivotTo(targetcframe)