hurt box connect() func error/

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By iiAnasEG

It gives me these errors:

1- Invalid argument for “connect()” function: argument 2 should be “Callable” but is “HurtBox”.

2- Invalid argument for “connect()” function: argument 3 should be “int” but is “String”.


 class_name HurtBox
 extends Area2D

func _init() -> void:
	monitorable = false
	collision_mask = 2

func _ready() -> void:
	connect("area_entered", self, "_on_area_entered")

func _on_area_entered(hitbox: HitBox) -> void:
	if owner.has_method("take_damage"):
:bust_in_silhouette: Reply From: JCJL

I believe the syntax you’re using is for godot 3.x and it has changed for godot 4.
Instead of:

connect("area_entered", self, "_on_area_entered")

Try this:


I believe the documentation on signals is updated to godot 4: