You are resetting points every call cause its defined inside the function and is not static. Try something like this:
Code:public class flashing : MonoBehaviour { void Update() { static int points = 0; if (Input.GetKeyDown(KeyCode.O)) points++; if (Input.GetKeyDown(KeyCode.F) && points == 5) { points = 0; light.enabled = !light.enabled; } } }