AddForce not working.

I currently have a movement system, and clicking the mouse makes you jump. Here is the code:

if (Input.GetMouseButtonDown(0))
{
    y_force = jumpPower * 10;
}
rb.AddForce(new Vector3(x_force, y_force, 0) * playerSpeed * Time.deltaTime * boosting);

For some reason, the jump sky rockets the player and pther times makes the player barely jump. Any ideas on how I can fix this? Or is this a bug?
rb.velocity works, but I still want the option to use addforce as well.

You’re using GetMouseButtonDown and rb.AddForce together and so one of those is in the wrong place.

GetMouseButtonDown is supposed to be used in Update and rb.AddForce is supposed be used in FixedUpdate. Also, you don’t need to use Time.deltaTime when adding forces in FixedUpdate.

bool jump;
void Update()
{
    if (Input.GetMouseButtonDown(0))
        jump=true;
}

void FixedUpdate()
{
    if (jump)
    {
        rb.AddForce(Vector3.up * jumpPower * boosting);
        jump=false;
    }
    rb.AddForce(Vector3.right * x_force * playerSpeed * boosting);
}

ok thanks