jumping problem runs infinitely

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

[RequireComponent(typeof(Animator))]
[RequireComponent(typeof(Rigidbody))]

public class Mover : MonoBehaviour
{
    public float velocidadMovimiento = 50f;
    public float velocidadRotacion = 600.0f;
    private Animator anim;
    public float x, y;
    public string InputButton = "Jump";//Ahora puedes acceder desde el editor y simplemente cambiar el input a tu gusto
    public string EjeX = "Horizontal";
    public string EjeY = "Vertical";
    Rigidbody Rb;
    public float Empuje = 1500f;//Potencia del salto
    public float ChekeoDeDistanciaAlSuelo = 0.5f;
    public float Compensacion = 0.5f;//desde donde parte el rayo
    public bool EstaEnElSuelo; //esta en el suelo o no
    void Start()
    {
        //Obtiene los Componentes
        anim = GetComponent<Animator>();
        Rb = GetComponent<Rigidbody>();
    }


    void Update()
    {
        //Checkea distancia al suelo
        DistanciaAlSuelo();
        //llama a la funcion MoveCharacter
        MoverJugador();
        //llama a la funcion Jumping
        if (Input.GetButtonDown(InputButton) && EstaEnElSuelo)
        {
            SaltarJugador();
        }

    }
    private void DistanciaAlSuelo() //Checkea distancia al suelo
    {
        Ray ray;
        ray = new Ray(transform.position - new Vector3(0, Compensacion, 0), -transform.up* ChekeoDeDistanciaAlSuelo);

        if (Physics.Raycast(ray, ChekeoDeDistanciaAlSuelo))
        {
            NoJump();
}
        else
        {
            IsJump();

        }
    }

    private void SaltarJugador()//salto de jugador
    {
       

     

        Rb.AddForce(transform.up * Empuje);//agrega una fuerza en el el eje y , y si te vas moviendo salta hacia adelante
        anim.SetBool("Jump",true);
    }


    private void MoverJugador(float x =0,float y=0)//mueve al jugador
    {
        x = Input.GetAxis("Horizontal");
        y = Input.GetAxis("Vertical");

        anim.SetFloat("VelX", x);
        anim.SetFloat("VelY", y);

        //Esto traslada al player en los ejes


        Vector3 Movimiento = new Vector3(x, 0.0f,y);

        Rb.AddForce(Movimiento * velocidadMovimiento);

        // Esto Rota al player al ir a otra direccion
    

        if (Movimiento != Vector3.zero)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(Movimiento.normalized), 0.2f);
        }

      

    }
    void NoJump()
    {
        EstaEnElSuelo = true;
        anim.SetBool("Jump", false);
    }
    void IsJump()
    {
        EstaEnElSuelo = false;
    }
    private void OnDrawGizmos()//Dibuja el rayo en el editor
    {
        Debug.DrawRay(transform.position - new Vector3(0, Compensacion, 0), -transform.up * ChekeoDeDistanciaAlSuelo, Color.magenta);
    }
}

Good afternoon I have a problem I am creating my character applying basic movements such as jumping and running but I already managed to jump but when I give it play it jumps infinitely it should not be that way what I want is that when I press the spacebar the character jumps normally since at running would follow your direction up. can you help me with the problem please

4843553–465482–Mover.cs (2.89 KB)

Hi, as a general piece of advice, i’d recommend always writing and commenting code in english, no matter what’s your native language. Generally speaking, this makes it easier to work on the code with other people, get help online, and keeps you from having to refactor your entire code should you end up working with someone not native to your language. As it is now, for most people all your variables and methods may as well be called ABC, which does not help understanding the code.

With that out of the way, you said you are jumping infinitely. I cant seem to reproduce this problem at all.
I used a Cube as GameObject and deleted the animator since i dont have any animations. In the described scenario i was not able to jump at all. To fix this i removed your Compensacion component from the raycast. Now i was able to only jump when on ground, not jump when in the air and fall down after a finite amount of time, all of which seems like desired behavior. That said, the applied amount of force makes you jump veeery high (like 40-50 meters).
Assuming the jump height to be desired, all of this seems to be proper behavior. Since it’s the only thing i deleted, may your problem actually be linked to the animator? I have little experience with animations as of right now.

Total code i used (removed compensacion from raycast and removed animator):
Modified Code

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

[RequireComponent(typeof(Rigidbody))]

public class Mover : MonoBehaviour
{
    public float velocidadMovimiento = 50f;
    public float velocidadRotacion = 600.0f;
    public float x, y;
    public string InputButton = "Jump";//Ahora puedes acceder desde el editor y simplemente cambiar el input a tu gusto
    public string EjeX = "Horizontal";
    public string EjeY = "Vertical";
    Rigidbody Rb;
    public float Empuje = 1500f;//Potencia del salto
    public float ChekeoDeDistanciaAlSuelo = 0.5f;
    public float Compensacion = 0.5f;//desde donde parte el rayo
    public bool EstaEnElSuelo; //esta en el suelo o no
    void Start()
    {
        //Obtiene los Componentes
        Rb = GetComponent<Rigidbody>();
    }


    void Update()
    {
        //Checkea distancia al suelo
        DistanciaAlSuelo();
        //llama a la funcion MoveCharacter
        MoverJugador();
        //llama a la funcion Jumping
        if (Input.GetButtonDown(InputButton) && EstaEnElSuelo)
        {
            SaltarJugador();
        }

    }
    private void DistanciaAlSuelo() //Checkea distancia al suelo
    {
        Ray ray;
        ray = new Ray(transform.position - new Vector3(0, 0*Compensacion, 0), -transform.up * ChekeoDeDistanciaAlSuelo);

        if (Physics.Raycast(ray, ChekeoDeDistanciaAlSuelo))
        {
            NoJump();
        }
        else
        {
            IsJump();

        }
    }

    private void SaltarJugador()//salto de jugador
    {




        Rb.AddForce(transform.up * Empuje);//agrega una fuerza en el el eje y , y si te vas moviendo salta hacia adelante
    }


    private void MoverJugador(float x = 0, float y = 0)//mueve al jugador
    {
        x = Input.GetAxis("Horizontal");
        y = Input.GetAxis("Vertical");

        //Esto traslada al player en los ejes


        Vector3 Movimiento = new Vector3(x, 0.0f, y);

        Rb.AddForce(Movimiento * velocidadMovimiento);

        // Esto Rota al player al ir a otra direccion


        if (Movimiento != Vector3.zero)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(Movimiento.normalized), 0.2f);
        }



    }
    void NoJump()
    {
        EstaEnElSuelo = true;
        Debug.Log("Not Jumping");
    }
    void IsJump()
    {
        EstaEnElSuelo = false;
        Debug.Log("Is Jumping");
    }
    private void OnDrawGizmos()//Dibuja el rayo en el editor
    {
        Debug.DrawRay(transform.position - new Vector3(0, Compensacion, 0), -transform.up * ChekeoDeDistanciaAlSuelo, Color.magenta);
    }
}