Need help rotating my ant on the Z axis towards his targetPosition

Hey, I am making an ant simulation and I want the ant to rotate towards his next targetPosition. (Only on the Z axis) For this I need to find out the angle between the ants currentPosition and the ants targetPosition:

float angle = Vector3.Angle(currentPosition, targetPos);

Then I rotate:

transform.localRotation = Quaternion.Euler(0, 0, angle);

But this doesn’t work. This only rotates the ant to the upper right or lower right a tiny bit. I have looked through a lot of other forum posts about rotation but I couldn’t get it to work. My understanding of rotation in Unity is complete dogshit so any help would be greatly appreciated :). Thanks in advance!

i think i’ve used something like this for Y

but i think rotating with .LookAt() should work also,

.LookAt() made it rotate in a very weird way. Making the sprite invisible. I just fixed it with this code:

        Vector3 vectorToTarget = targetPos - transform.position;
        float angle = Mathf.Atan2(vectorToTarget.y, vectorToTarget.x) * Mathf.Rad2Deg;
        Quaternion q = Quaternion.AngleAxis(angle, Vector3.forward);
        transform.rotation = Quaternion.Slerp(transform.rotation, q, Time.deltaTime * 2f);

Thanks for the help anyway!