Recording the max height of a player

Hello! I’m making a feature in a game that records the maximum height the player has traveled and displays it. I have it all down except the recording of the maximum height, as right now all it does is record the current height. Help?

 public float moneyAmount;
    public float heightAmount;
    public float maxHeight;
    //ignore these below
    public float speed;
    public float jumpSpeed;
    public KeyCode jumpKey = KeyCode.Space;
    public KeyCode walkRightKey = KeyCode.D;
    public KeyCode walkLeftKey = KeyCode.A;
    public Transform playerTransform;
    RaycastHit2D hit;
    // Use this for initialization
    void Start()
    {
    }
    // Update is called once per frame
    void Update()
    {
        heightAmount = playerTransform.position.y;
        maxHeight = Mathf.Max(heightAmount);

You probably want to set maxHeight as the maximum of both the current maxHeight and the current player height.

Like this? (I tested it and it didn’t work)

maxHeight = Mathf.Max(heightAmount);
        maxHeight = Mathf.Max(maxHeight);

No. Look at the documentation for Max: Unity - Scripting API: Mathf.Max

Check that it allows for multiple parameters.