From what I can see, there's an issue with your condition:
elif Input.is_action_just_pressed("ui_up") and current_selection < 0:
You're checking if
current_selection is less than zero while you should check if
current_select is more than zero. So:
elif Input.is_action_just_pressed("ui_up") and current_selection > 0:
That'll hopefully fix the issue.
Btw an easier way to do something like this (Adding an ">" to show the selection) would be to use
You simply add the ">" when the button gains focus and remove it when it loses focus.
You could create a single script called
menu_button.gd and attach it to both of your menu nodes. The script could look something like this:
connect("focus_entered", self, "_on_focus_entered")
connect("focus_exited", self, "_on_focus_exited")
text = text.insert("> ")
text = text.trim_prefix("> ")
Remember that one of your nodes must start with focus for this to work. That's why we have an exported variable called
starts_with_focus. Using an exported variable makes it easier to choose which one of your nodes will start with focus.
Edit: Suggested a possibly easier way to do what OP wants to do.