Problem with movement

So… I´ve got a problem. when i move my character and jump at the same time, it sets isGrounded on false so he can´t jump anymore.
But if I jump and then push D so the character moves right, the player flies till he gets to ground.
Here is my code :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Movement : MonoBehaviour
{
public float sprintSpeed = 7.5f;
public float speed = 5.0f;
public float skok;
public float gravitace;
private float hI;
private Rigidbody2D rb;
public bool jeNaZemi = true;
private bool vPravo = true;
public Vector2 pohybovani;
// Start is called before the first frame update
void Start()
{
rb = GetComponent();
Physics2D.gravity *= gravitace;
}

// Update is called once per frame
void Update()
{
    hI = Input.GetAxisRaw("Horizontal");
    if (Input.GetKey(KeyCode.D))
    {
        rb.velocity = new Vector2(speed, 0);
    }
    if (Input.GetKey(KeyCode.A))
    {
        rb.velocity = new Vector2(-speed, 0);
    }

    if (Input.GetKey(KeyCode.LeftShift))
    {
    
    }
    if (Input.GetKeyDown(KeyCode.Space) && jeNaZemi)
    {
        rb.AddForce(Vector3.up * skok, ForceMode2D.Impulse);
        jeNaZemi = false;
    }
    if (vPravo == false && hI > 0)
    {
        Pretocit();
    }
    else if (vPravo == true && hI < 0)
    {
        Pretocit();
    }
}
private void OnCollisionEnter2D(Collision2D collision)
{
    jeNaZemi = true;
}
void Pretocit()
{
    vPravo = !vPravo;
    
    Vector3 Scaler = transform.localScale;
    Scaler.x *= -1;
    transform.localScale = Scaler;
}
private void FixedUpdate()
{
    
}

}

try replacing rb.velocity = new Vector2(speed, 0); with rb.velocity = new Vector2(speed, rb.velocity.y);
Then you won’t lose your y velocity value.

@Rostislavvacek116

If jeNaZemi is never getting reset to true then you need to look into your OnCollisionEnter2D method (Rigidbody2D & Collider2D).

I see you using the Rigidbody2D in code so, I would check the Collider2D and make sure it is configured correctly.