Disable Jump more than 1 time

Hey,
i’m new to the unity engine and have a sphere to walk on. the gravity is pulling the player onto the ground. You can watch by moving the mouse around.

I wanted to make the player being able to jump just 1 time. So i used the if statement to disable jumping again while jumping. But it doesn’t work, even with if, i can jump whenever i want to.
Can some1 solve this =?

Here my code:

public float mouseSensitivityX = 250f;
public float mouseSensitivityY = 250f;
public float walkSpeed = 4f;
public float jumpForce = 220;
public LayerMask groundedMask;

private Transform cameraT;
private float verticalLookRotation;

private Vector3 moveAmount;
private Vector3 smoothMoveVelocity;

private bool grounded;

private void Start()
{
cameraT = Camera.main.transform;
}

private void Update()
{
transform.Rotate(Vector3.up * Input.GetAxis(“Mouse X”) * Time.deltaTime * mouseSensitivityX);
verticalLookRotation += Input.GetAxis(“Mouse Y”) * Time.deltaTime * mouseSensitivityY;
verticalLookRotation = Mathf.Clamp(verticalLookRotation, -60, 60);
cameraT.localEulerAngles = Vector3.left * verticalLookRotation;

Vector3 moveDir = new Vector3(Input.GetAxisRaw(“Horizontal”), 0, Input.GetAxisRaw(“Vertical”)).normalized;
Vector3 targetMoveAmount = moveDir * walkSpeed;
moveAmount = Vector3.SmoothDamp(moveAmount, targetMoveAmount, ref smoothMoveVelocity, .15f);

if (Input.GetButtonDown(“Jump”))
{
if (grounded)
{
GetComponent().AddForce(transform.up * jumpForce);
}
}
grounded = false;
Ray ray = new Ray(transform.position, -transform.up);
RaycastHit hit;

if (Physics.Raycast(ray, out hit, 1 + .1f + groundedMask))
{
grounded = true;
}
}

private void FixedUpdate()
{
GetComponent().MovePosition(GetComponent().position + transform.TransformDirection(moveAmount) * Time.fixedDeltaTime);
}

The Problem was solved, here the new Code:

private void Update()
{
Ray ray = new Ray(transform.position, -transform.up);
RaycastHit hit;

if (Physics.Raycast(ray, out hit, 1.0f))
grounded = true;
else
grounded = false;

transform.Rotate(Vector3.up * Input.GetAxis(“Mouse X”) * Time.deltaTime * mouseSensitivityX);
verticalLookRotation += Input.GetAxis(“Mouse Y”) * Time.deltaTime * mouseSensitivityY;
verticalLookRotation = Mathf.Clamp(verticalLookRotation, -60, 60);
cameraT.localEulerAngles = Vector3.left * verticalLookRotation;

Vector3 moveDir = new Vector3(Input.GetAxisRaw(“Horizontal”), 0, Input.GetAxisRaw(“Vertical”)).normalized;
Vector3 targetMoveAmount = moveDir * walkSpeed;
moveAmount = Vector3.SmoothDamp(moveAmount, targetMoveAmount, ref smoothMoveVelocity, .15f);

if (Input.GetButtonDown(“Jump”))
{
if (grounded)
GetComponent().AddForce(transform.up * jumpForce);
}
}

In the tool bar at the top of the respond box there is a button named insert. Under insert there is a Code formatting option that will format the code and make it easier to read. Also unless you are going to have more than 1 sphere with gravity, all of this physics coding is pointless. If you only have one sphere I would suggest a shader like this one:
https://alastaira.wordpress.com/2013/10/25/animal-crossing-curved-world-shader/