Connect signal from instanced node

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

I’m trying to make a points counter label. Every time a block is hit, it should add value to the label text. This node emits a signal to another scene, the game scene.

signal pts(qt)
func hit(damage , node):
	health -= damage
	emit_signal("pts" , damage)

The complication is that the block scene is instanced on the game scene.

onready var pre_brick = preload("res://scenes/block.tscn")
var bricks = null
var brick = pre_brick.instance()
				bricks = brick

I’m trying to connect to the signal like this, but I don’ think it is working.

bricks.connect("pts" , self , "on_pts")

How do I connect to an instanced object signal?

:bust_in_silhouette: Reply From: jacktype

Hi! Your code looks correct to me. Make sure your receiving method on the game scene is declared with the argument “damage” present like so:
func on_pts(damage):
Signals don’t seem to work if the receiving method is not declared with the correct number of arguments.