Problem with getting the correct world to screen positions

I’m trying to get the world to screen position but something isn’t working as I thought it should. With my code the z (which will be the y for the gui object) says it’s always the same when I use the WorldToScreenPoint even though it is completely different in the world positioning.

Here is the code:

void OnGUI(){
    
    if(_showRing){
    	GUI.Box(new Rect(ringPos.x,ringPos.y,100,100),"",ring);
    }
    
}
    
public void WaypointBeingEdited(Transform waypoint){
    editedWaypoint = waypoint;
    ringPos = Camera.main.WorldToScreenPoint(new Vector3(editedWaypoint.transform.position.x,editedWaypoint.transform.position.z,0));
    _showRing = true;
}

Any help with this would be very much appreciated! And if you need any more information please tell me and I will update the post.

With my code the z (which will be the
y for the gui object)

Did you try using the y coordinate? why are you using the Z coordinate to convert from world to screen?