Signals could do it. Connect the node here:
func _ready():
Self.connect(“body_entered”, self, “on_body_entered”)
And then put your event here, assuming the player object is called “player”:
func on_body_entered():
If body.name == “player”:
If Input.is_action_pressed(‘space_key’):
# your text event
My logic is a bit messy but that should be enough to get you there. There is also a plugin named Dialogic that can help specifically with the effect you are looking for.