This is my first game ever, I have zero coding knowledge other than the absolute basics. I'm making a text based adventure and I'm trying to make it scroll down to the latest response every time the player makes an action. Ive had to watch a couple of older tutorials to get this far, but i cant find anything on what arguments this function is looking for so I'm not sure how to fix it.

The error it gives me is "Invalid type in function 'connect' in base 'VScrollBar' cannot convert argument 2 from Object to Callable"

extends Control

const InputResponse = preload("res://input_response.tscn")

@onready var game_history = $Background/Margin/Rows/GameInfo/Scroll/GameHistory
@onready var scroll = $Background/Margin/Rows/GameInfo/Scroll
@onready var scrollbar = scroll.get_v_scroll_bar()



func _ready() -> void:
	scrollbar.connect("changed", self, handle_scroll_bar_changed())


func handle_scroll_bar_changed():
	scroll.scroll_vertical = scrollbar.max_value


func _on_input_text_submitted(new_text: String) -> void:
	var input_reponse = InputResponse.instantiate()
	input_reponse.set_text(new_text, "Test")
	game_history.add_child(input_reponse)
  • xyz replied to this.

    TheChonk85 connect() arguments changed between Godot 3.x and 4. However, what you currently have in code would work with neither.
    Godot 3.x:

    # pass object whose method we're calling and the method name as a string
    scrollbar.connect("changed", self, "handle_scroll_bar_changed") 

    Godot 4:

    # pass method as callable (callable is a new type of object in Godot 4. It's basically a reference to a method)
    scrollbar.connect("changed", handle_scroll_bar_changed)

      xyz Thank you so much for your help, that fixed it right up.