...Bruh? Why is my character being rotated?

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)

Result:

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)

Try this

1 Like

You don’t know how grateful I am that you helped me with this bro I tried doing that before but I did it this way which was wrong:

		targetcframe = CFrame.new(cast.Position) * CFrame.Angles(rootorigin.Rotation)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.