Camera won't follow player object of the Y axis.

I have a script written for my camera to follow the player as it moves around, and it works on the X-axis, but not the Y, give me suggestions. I’m new to code.

Here is the code:
public class FollowPlayer : MonoBehaviour
{
//Variables
private Transform PlayerTransform;
public GameObject Player;
public Rigidbody2D rb;
void Start()
{
PlayerTransform = GameObject.FindGameObjectWithTag(“Player”).transform;
}

void LateUpdate()
{
Vector3 temp = transform.position;
temp.x = PlayerTransform.position.x;
transform.position = temp;
temp.y = PlayerTransform.position.y;

}
}

You are assigning the PlayerTransform.position.y in temp.y. But you never assign temp.y to camera transform

For the next one, remember to put the code in the Insert Code

Okay, Thank you, I’ve never used these forums before, sorry.

@JustaDuck97

Code tags how to: Using code tags properly