How to make a object face another object

Ok so I’m currently using this code
var target: Transform;

function Update(){

But my problem is the object that faces my character is laying on the ground.

First, you need to make sure the side you want to face the player is the side of your object that faces positive ‘z’ when the rotation is (0,0,0). If that is correct, then the next thing to do is take a look at the optional second parameter to the LookAt() function. It is the preferred axis of rotation. For something that is laying on the ground, you might do:

transform.LookAt(target.position, transform.up);

This will use the local ‘up’ of the object as the preferred axis of rotation no matter what the angle.