Issues with keeping rotation when teleporting player

Whenever i use this method the orientation from where i teleport is reversed, or randomized for some reason

plr.Character.PrimaryPart.CFrame =, MouseHit.Y + 4, MouseHit.Z) * CFrame.Angles(plrHRP.Rotation.X, plrHRP.Rotation.Y, plrHRP.Rotation.Z)

I’ve been trying to debug this for an hour now and i cannot find out why.

I really want to teleport the player and keep his orientation/rotation.

Reason why i didn’t move the humanoidRootPart is because it experienced some issues and glitched out the player for no reason and put him out of proportion.


Does this work for you?

-- Get the player and their current position and orientation
local player = game.Players.LocalPlayer
local currentPosition = player.Character.HumanoidRootPart.Position
local currentOrientation = player.Character.HumanoidRootPart.Orientation

-- Define the range of coordinates for the random teleport
local minX = -50
local maxX = 50
local minY = 5
local maxY = 20
local minZ = -50
local maxZ = 50

-- Generate random coordinates within the defined range
local newX = math.random(minX, maxX)
local newY = math.random(minY, maxY)
local newZ = math.random(minZ, maxZ)

-- Teleport the player to the new location while keeping orientation
player.Character.HumanoidRootPart.CFrame =, newY, newZ),, currentOrientation.y, currentOrientation.z))

Works but i cannot use humanoidrootpart cause it messes with the character. My friend said my character was put out of proportion. I used primarypart of the characters model and it’s still reversed for some reason


have you tried doing:



For Models with a primarypart:

-- Get the model you want to move
local model = game.Workspace.YourModelNameHere

-- Define the target location
local targetPosition =, y, z) -- Replace x, y, and z with the desired coordinates

-- Move the model to the target location

Worked, it works well now thank you


Do you have a version that also keeps it’s rotation, i took wrong sorry

-- Get the model you want to move
local model = game.Workspace.YourModelNameHere

-- Define the target position and the current orientation of the model
local targetPosition =, y, z) -- Replace with desired target position
local currentOrientation = model.PrimaryPart.CFrame:toEulerAnglesXYZ()

-- Create a new CFrame with the target position and the original orientation
local newCFrame = * CFrame.Angles(currentOrientation.x, currentOrientation.y, currentOrientation.z)

-- Apply the new CFrame to the model's primary part

You could just refer to the previous code I sent, pretty much the same thing


Alright thanks man, appreciate it for taking your time

1 Like

I’m sorry but i am getting a error saying: Attempt to index number with X

local CurrentOrientation = plr.Character.PrimaryPart.CFrame:toEulerAnglesXYZ()
local newCFrame =, MouseHit.Y + 3, MouseHit.Z) * CFrame.Angles(CurrentOrientation.X, CurrentOrientation.Y, CurrentOrientation.Z)
1 Like

Overlooked that.
Assign it to 3 different variables then you can fix the rest.
local OrientX, OrientY, OrientZ = cf:ToEulerAnglesXYZ()


Works, Thanks G

30 msg limit aaaaaa

1 Like

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