PivotTo Resets Orientation

Hi All,

I’ve been trying to change the rotation of a Model when you press the key 'R', but there’s a loop that constantly changes the Model’s Position which resets the orientation.

Here is my script:

--// Model Rotation Code
UserInput.InputBegan:Connect(function(key, p)
	if p then return end
	if key.KeyCode == Enum.KeyCode.R then
				
		TowerRootPart.CFrame *= CFrame.Angles(0, math.rad(90), 0)
			
	end
end)

--// Model Follow Mouse Code
Mouse.Move:Connect(function()

	local MousePos = Mouse.Hit.Position
	local TargetPart = Mouse.Target
	if not TargetPart then return end

	TempTower:PivotTo(CFrame.new(MousePos.X, TargetPart.Position.Y + 2.6, MousePos.Z))
          --^^ Line that Resets Models Orientation

end)

If there is any way to only move the tower only by Position without changing Orientation please tell
me.
Thanks a lot for your help!

2 Likes

just add the orientation on the cframe when you call PivotTo

2 Likes

idk how to do that though EeEE

2 Likes