Godot 4.4
One line caused my button not working, its about ui and dimming the BG when dialogue occurs buts this one instance keep giving errors (im a beginner on this engine)
Question
how can i fix this? the line: button.connect(“pressed”, self, “_on_button_pressed”)
the whole script:
extends CanvasLayer
@onready var button = $Button
@onready var label = $Panel/Label
@onready var color_rect = $ColorRect
var dialogue = [“Hello there.”, “click the button to proceed.”]
var current_line = 0
func _ready():
$Panel.visible = false
$ColorRect.visible = false
button.connect("pressed", self, "_on_button_pressed")
func _on_button_pressed():
if current_line == 0:
$Panel.visible = true
$ColorRect.visible = true
$ColorRect.color = Color(0, 0, 0, 0.5)
if current_line < len(dialogue):
label.text = dialogue[current_line]
current_line += 1
else:
$Panel.visible = false
$ColorRect.visible = false
current_line = 0
it gave me 3 errors:
-Invalid argument for “connect()” function: argument 2 should be “Callable” but is “res://script/canvas_layer_2.gd”.
-Cannot pass a value of type “String” as “int”.
-Invalid argument for “connect()” function: argument 3 should be “int” but is “String”.