So I have this text display event that pops up when the player enters an Area2D and presses a button. The program is doing what I want it to, but apparently I have to press a button TWICE to trigger the text display after the scene first changes/loads. When accessing the point any other time, it does it right on the first press (if the event has occurred once already, it boots up on first press). I think I've been looking at it too long.

I have a textbox object as an instanced scene, it's not what's malfunctioning though, so there are custom functions. Almost positive the problem is somewhere in the Input section, as I have a bulletin event that is quite similar but works fine (displays texts without player input). I am positive it is something obvious I am missing.

extends Area2D


### open event flag and objects
var _can_search = false
onready var _look = $LookSprite
onready var _run = $RunSprite

### text values and state
onready var _textbox = $TextAnimation
onready var _dialog = $TextAnimation/Label
export var _textLine1 : String
export var _textLine2 : String
export var _textLine3 : String
export var _textLine4 : String
var _textsArray = [_textLine1,_textLine2,_textLine3,_textLine4]
var _nextText = _textLine1
const _EMPTY = ''


### make text invisible at boot (visible in editor)
func _ready():
	_look.visible = false


### input command
func _input(_event):
	if _can_search:
		if Input.is_action_just_pressed("_interact"):
			_displayed()


### pull from array and display, if it's empty, exit.
func _displayed():
	_look.visible = false
	_nextText = _textsArray.pop_front()
	
	if _nextText != _EMPTY:
		_textbox._update(_nextText)
		_textbox._fade_in()
		DirectorNode._freezePlayer = true
	else:
		_textbox._fade_out()
		DirectorNode._freezePlayer = false
		_textsArray = [_textLine1,_textLine2,_textLine3,_textLine4]
	

func _on_SearchEvent_body_entered(body):
	if body.name == 'Lydia':
		if DirectorNode._chaseMode == false:
			_can_search = true
			_look.visible = true
		else: ### disable event if pursued!
			_can_search = false
			_look.visible = false
			_run.visible = true


func _on_SearchEvent_body_exited(body):
	if body.name == 'Lydia':
		_can_search = false
		_look.visible = false
		_run.visible = false
  • func _input(_event):
    	if _can_search:
    		if Input.is_action_just_pressed("_interact"): <- This line
    			_displayed()

    Never ever use Input inside _*_input functions, use the passed event instead.

    func _input(_event):
    	if _can_search:
    		if event.is_action_pressed("_interact"):
    			_displayed()
func _input(_event):
	if _can_search:
		if Input.is_action_just_pressed("_interact"): <- This line
			_displayed()

Never ever use Input inside _*_input functions, use the passed event instead.

func _input(_event):
	if _can_search:
		if event.is_action_pressed("_interact"):
			_displayed()

    AnidemDex this didn't fix my problem BUT is a good catch regardless. Didn't realize I had done that so I fixed it anyways.

    My jerry rigging solution was to just run the displaying function at ready. This apparently solved it. But thank you for taking the time to answer!