How can I make a smoother follow mouse script?

I have a script that makes your character follow your mouse, but equipping tools sometimes makes your character move at random places.

Here is an example of what I am talking about, the entire time, I was holding only the A key.
https://gyazo.com/4978eee3a66cb225e6d8c1cada87d560

I have tried CFrame, but it breaks in the same way aswell.

Script that I am using.

Players = game:GetService('Players')
Player = Players.LocalPlayer
Mouse = Player:GetMouse()
Char = Player.Character
if not Char then
	Player.CharacterAdded:Wait()
	Char = Player.Character
end

RootPart = Char:WaitForChild('HumanoidRootPart')

RunService.Stepped:connect(function()

	local MousePos = Mouse.Hit.p

	local lookVector = Vector3.new(MousePos.X,RootPart.CFrame.Y,MousePos.Z)

	RootPart.CFrame = CFrame.new(RootPart.CFrame.p,lookVector)

end)
1 Like

Have you tried setting the Humanoid.AutoRotate property to false?

1 Like

Try TweenService to do the actual movement? For consistency-sake, you can save the difference between the last 2 points to have a constant rotation speed.

1 Like

How can I set the autorotate to false?

1 Like

If you have a starter characrer, then go to the humanoid, and set the property to false. If you don’t, put a humanoid into the starterplayer and set it there.

2 Likes