Jittery movement when facing player to mouse

I’ve got a script that makes the player face towards where the mouse is pointing. However, whenever the player moves, it becomes all jittery, and I do not know why. The script is below. Is anyone able to help?

local Character = character
local Root = character.HumanoidRootPart

local RootPos, MousePos = Root.Position, mousePos
Root.CFrame = CFrame.new(RootPos, Vector3.new(MousePos.X, RootPos.Y, MousePos.Z))

Try to turn of AutoRotate whenever you equipping the gun

1 Like