Character look at mouse bugging with movement

Hi I recently made a pretty simple script that makes the character look at where your mouse is pointing, however when its combined with the r15 movement it makes it go in another direction relative to the direction that you are moving.
https://gyazo.com/31e2b4c4294590b504414f57ad7e465b

drawCon = game:GetService("RunService").RenderStepped:Connect(function()
  local mouse = game.Players.LocalPlayer:GetMouse()
  local charRay = Ray.new(mouse.Origin.Position, mouse.UnitRay.Direction * 250)
  local charIgnoreList = {Character, game.Workspace.CurrentCamera}
				
  local foundValid = false
					
	repeat 
		hitPart, hitPos = workspace:FindPartOnRayWithIgnoreList(charRay, charIgnoreList)
		if hitPart then
			if not (not hitPart.CanCollide) then
				foundValid = true
			else
				table.insert(charIgnoreList, hitPart)
			end
		else
			foundValid = true
		end
	until foundValid
				
Character.HumanoidRootPart.CFrame = Character.HumanoidRootPart.CFrame:lerp(CFrame.new(Character.HumanoidRootPart.CFrame.p, Vector3.new(hitPos.X, Character.HumanoidRootPart.Position.Y, hitPos.Z)), 0.2);
end)

Resolved. AutoRotate was enabled.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.