CFrame.lookAt() issue

I want an enemy to look at the player without setting its position, I just want the orientation to change. Its jittering around very weirdly which I do not like.

Is there any alternatives to CFrame.lookAt() that only set the orientation and nothing to do with the position? (i tried setting the orientation but i dont know enough math to get the orientation to lookat the player)

something i tried:

			   if Config.turn == true then
					local tw = game.TweenService:Create(script.Parent.HumanoidRootPart,,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,false),{CFrame = CFrame.lookAt(script.Parent.HumanoidRootPart.Position,v.Character.HumanoidRootPart.Position)})
1 Like

To just rotate the enemy try the following:

local enemy = script.Parent   -- assumption
local rotateCFrame = CFrame.lookAt(enemy.HumanoidRootPart.Position,
local tw= TweenService:Create(enemy.HumanoidRootPart, rotateTweenInfo, {CFrame = rotateCFrame})
1 Like

This fixed nothing, it actually made it worse because while it does turn, it doesn’t move. Also, there are a few errors in this code.

1 Like

You are using CFrame.LookAt(). is what you want.
using,vect3) will make a cframe that has the position of the first argument and have the rotation to look at the second.

CFrame | Documentation - Roblox Creator Hub

The only change you want to make is change lookat to new