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)