Is my signal just incorrect?

Godot Version

4.2

Question

from my understanding this is how signals work using code …

some_node declares a signal

signal my_signal

send out signal for anyone listening

if something_happened:
my_signal.emit()

in listener _ready() function

some_node.my_signal.connect( my_function )

in listener script

def my_function():
doSomething()

it seems very simple to grasp in concept but for some reason im getting
this error(in screenshot).

is the the engine not detecting the “enemy.knight_slain” for any reason?

ive been scouring the web on a fix to this error and am defeated

Your variable enemy is an Array, how is it declared/set? You will have to index into the array to get the signal, either with a for look (multiple enemies) or square brackets for just one.

At this point it isn’t the signal that is the problem.
The error is telling you that enemy is an array and arrays don’t have knight_slain as a method, property, or signal.
You don’t show where enemy is defined but you are likely wanting to access one of its elements to get at the signal:
enemy[0].knight_slain.connect(_on_knight_defeat)

Why does your player script get nodes in group “player”? and why do you have two player scripts one capitalized and one lowercase?

If you want every starting enemy to connect to this signal then you will have to use a for loop. However, not every enemy may be ready when the player is ready; you could add a frame delay to guarentee it and remove the global enemy variable.

func _ready() -> void:
    await get_tree().process_frame # wait one frame for everything to be ready
    var enemies := get_tree().get_nodes_in_group("enemy")
    for enemy in enemies:
        enemy.knight_slain.connect(on_knight_slain)