I just got into developing using unity and I got the fps movement going, but I decided to test myself and tried to add a sprint toggle feature with my own code and it doesn't work, the issue is when I go into play mode and press left ctrl it doesn't change the value of speed, any suggestions would be appreciated.
if (speed == 5.0f && Input.GetButtonUp("LeftControl"))
{
speed += 2f;
}
if (speed == 7.0f && Input.GetButtonUp("LeftControl"))
{
speed -= 2f;
}