Torso rotate script won't follow mouse correctly

okay so i got some code where the character rotate towards the mouse location but the torso won’t follow the mouse full 360

Code:

		HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.CFrame.p, HumanoidRootPart.CFrame.p + Vector3.new(Mouse.hit.lookVector.x, 0, Mouse.hit.lookVector.z))

Result:
https://gyazo.com/83443c617ad46bcbf80face5cc4f1ce0

Try

CFrame.lookAt(HumanoidRootPart.Position, mouse.hit.p)

Not tested btw

1 Like

This just flings the character :rofl:

:flushed:
Damn. I didn’t test it at all and it’s 12:11 am and am just a daze sorta rn.

1 Like

There are many errors with this method, cause roblox raycasts from the humanoid root part for realistic movement so when you rotate your character fully it gives weird behaviors such as flinging etc, So the best method is using a hinge contraint to move our torso alone if you want, and rotating the humanoid root part (excluding y-axis), I’ll try my best to give you a sample script ASAP!

1 Like