explanation: i want the two buttons on the right for the character the player will select.

for reference, i tried to do this tutorial :
it all work up until i get this error :
Attempt to call function 'get_children' in base 'null instance' on a null instance.

the error are from these part:
for node in player_selection_box.get_children():
if node.get_global_rect().has_point(mousePos):
return node

any help is appreciated !

    kuligs2

    here you go:

    extends Control

    @onready var player_selection_box = $BoxContainer

    func _input(event):
    if event is InputEventMouseButton && event.button_index == 1 && event.is_pressed():
    var charNode = _get_char_node()

    	if charNode: _set_char_selected(charNode)

    func _get_char_node():
    var mousePos = get_viewport().get_mouse_position()

    for node in player_selection_box.get_children():
    	if node.get_global_rect().has_point(mousePos):
    		return node

    func _set_char_selected(charNode):
    Global.playerCharPath = charNode.characterPath

    for node in player_selection_box.get_children():
    	var isSelected = charNode == node
    	node.set_selected(isSelected)

    func _on_cloud_pressed():
    Global.character = "Cloud"
    get_tree().change_scene_to_file("res://scene/playground.tscn")

    func _on_mike_pressed():
    Global.character = "Mike"
    get_tree().change_scene_to_file("res://scene/playground.tscn")

    func _on_play_button_pressed():
    if not Global.playerCharPath: return
    get_tree().change_scene_to_file("res://scene/playground.tscn")

      sdi498 for node in player_selection_box.get_children():
      if node.get_global_rect().has_point(mousePos):
      return node

      well you never check if node is not nothing. Clearly when you do something and expect something, then you need to check if it is something and not nothing.

      depending on the case you could do somehting like:

      func myfunc():
          var targetPath 
          targetPath = TargetNode.get_path()
          if has_node(targetPath):
              # rest of the code