how to add releasing a button as a condition in a if statement

if (chMotor.grounded && Input.GetKey(“left shift”) || Input.GetKey(“right shift”) && stamina > 0){
speed = runSpeed;
stamina–;
}
else if(stamina == 0 || stamina > 90)
{
stamina++;
speed=7;
}

how do i make the else loop start when i release the left shift. i have tried the get button up to no avail. is there a command I’m missing

1 Answer

1

if (Input.GetKeyUp(“left shift”) {
//whatever
}

works, but only if it is outside of your if-else statement, that already checks for GetKey

Hope this helps, Benproductions1

thank you soo much

–