Problem with transform.LookAt and if statement

I don’t get any errors and I believe that his should definitely work, but it doesn’t.
anyone know why?
(the speed variable and the playerNearby bool both work but the object never looks at the target.)

void Update ()
	{
		if (playerNearby == true && speed > 1.0f)
	{
			transform.LookAt(target);
	}
}

First make sure that the condition is actuality met.
You can use a call of Debug.Log(“Condition is met”); to make sure it is met.

Is there any other code that could overwrite the rotation of the lookAt afterwards (other script or maybe a animator)