Connecting signals with clones

Godot Version

4.6.1

Question

I’ve coded in an item that when interacted with, clones itself. The cloning works perfectly fine, but the clones need to send a signal to the parent. Since the clones are, well, clones, the signal they emit isn’t connected to the parent. I’ve searched around on the forums and most said to make the signal the clones emit connect to their parent via connect(), but for some reason it’s not working? I can tell from using print() that the clones ARE getting the “picked_up” function working, so I believe it’s the signal that the problem here.

The code for the item that is picked up and cloned:

extends Node3D

signal bronzecamerapickedup

func ready():
	self.bronzecamerapickedup.connect(get_parent)

func picked_up():
	Global.bronzecamera += 1
	bronzecamerapickedup.emit()

The code for the item “manager” who the item is the child of:

extends Node

func ready():
	pass

func _on_bronzecamera_bronzecamerapickedup():
	for i in 10:
		var bronzecamerainstance := preload("res://bronzecamera.tscn").instantiate()
		bronzecamerainstance.position = Vector3(randf_range(1,2),randf_range(1,2),randf_range(1,2))
		add_child(bronzecamerainstance)

You are connecting your signal to get_parent, this function returns the node’s parent and does nothing else. when the signal is emitted, get_parent is called and does nothing.

You want to connect this signal when the instance is added to the scene.

func _on_bronzecamera_bronzecamerapickedup():
	for i in 10:
		var bronzecamerainstance := preload("res://bronzecamera.tscn").instantiate()
		bronzecamerainstance.position = Vector3(randf_range(1,2),randf_range(1,2),randf_range(1,2))
		add_child(bronzecamerainstance)
		bronzecamerainstance.bronzecamerapickedup.connect(_on_bronzecamera_bronzecamerapickedup)