Connecting signal from enemy script to player script using code issue

Godot Version

4.2

Question

for the last 3 days I’ve been attempting to solve this issue on my own using docs, google ,and GPT suggestions with no success, so now im turning to forums

I am trying to connect a signal from my enemy to my player.

when the enemy dies i want it to signal that to the player script, and use the “on_knight_defeat” function that is in the player script.

what is the best possible way to get a system like this up and running in godot 4?




Your connect syntax is wrong. The old syntax, which you’re using, would be:

enemy.connect("knight_slain",self,"on_knight_defeat").

The new syntax would be:

enemy.knight_slain.connect(on_knight_defeat)

1 Like

You havent instanced your scene, you’re calling it on a PackedScene

1 Like