Flashlight Toggle

Your input bindings are calling this functions on the Flashlight Action Event. FlashlightOn() is called on IE_Pressed (when the key first goes down) and FlashlightOff() is called on IE_Released (when the key comes back up). Thus you’re getting exactly what you’re code says.

To do a toggle instead, you can remove your on/off bindings and replace them with a single binding for flashlight toggle, wherein you toggle the state of IsFlashlightOn

void ASleepCharacter::SetupPlayerInputComponent(class UInputComponent* InputComponent)
{
  // ...
   InputComponent->BindAction("Flashlight", IE_Pressed, this, &ASleepCharacter::FlashlightToggle);
   //...
}


 void ASleepCharacter::FlashlightToggle()
 {
         IsFlashlightOn = !IsFlashlightOn
         //FlashLightComponent->ToggleVisibility("Flashlight"); 
         //May need to move this ^ to Tick() or timer; it could work here, but haven't tested
 }