How can i make text appear when interacting with an object?

I want to make it so i can left click or hit E to display text on the screen. For context I’m making a horror game and want it so when you interact with a light switch, it wont work and instead the player will say “i flipped the light switch but nothing happened.” thank you in advanced!

Yes. Look into the Text component: Text | Unity UI | 1.0.0

You can simply keep the Text disabled until you wish to show it onscreen, at which point you set the text and enable it.