i made something fast with the first person shooter template for you but it work.
1: in the first person character add a variable called isflashlightopen? then add the blueprint for when f is press and released with the variable
2: create an actor
3: add a text render inside the actor you created
4: add this blueprint inside of the actor
5: add the actor to the world and press play then press F to show the text (simulated flashlight)