Button in Area2D does not disappear when the body does not enter Area2D

Godot Version

Godot 4.2.2`

Question

Button in Area2d does not disappear when I start the scene, but when the body enters Area2D and left, the button disappears.
Area2D.gd
extends Area2D

go to the scene 2

var interaction_flag = false

hide at start

func _ready():
if $nextScene:
$nextScene.hide()

when a player enters within the area, show the icon

func _on_body_entered(_body):
if $nextScene:
$nextScene.show()
interaction_flag = true

when a player is not within the area, show the icon

func _on_body_exited(_body):
if $nextScene:
$nextScene.hide()
interaction_flag = false


When i start the scene, the button shows. I want it to be hidden

I think the problem lies with the layout, the area surrounding your $nextScene is overlapping the box that defines the edge of the screen. Try moving it to the left so its not overlapping. If that solves the problem, then you have two options, either keep it not overlapping, or check to make sure the body entering it is the player and not something else, then if it is, show it.

Just as an example, if your player node is named Player, you would put:
func _on_body_entered(_body):
if _body == “Player”:
$nextScene.show()
interaction_flag = true

Or, if the on_body_entered(_body) script is attached to the player node and not the button node, you would replace “Player” with “nextScene” since it looks like that is the name of your button.

Thank you so much