#Connecting signal from root/level1/player/hud to root/globals

1 messages · Page 1 of 1 (latest)

verbal slate
#

I have an autoload global singleton that holds my player health and save point. The hud has a button that will emit signal save_pressed when pressed. I cannot connect this to my globals script. Any idea why?

(Button signal to hud is not in yet)

#

game crashes on lauch btw

burnt blade
#

You should probably connect the signal in your hud script’s _ready

#

Your scenes should reference the autoload, the autoload shouldn’t reference the scenes

#

Also final note, don’t do connect(“save_pressed”, save), instead do save_pressed.connect(save)

verbal slate
#

the error now is: save_pressed not declared in current scope

#

also the hud script was for some reason (most likey not saving) not connected to the hud node

burnt blade
verbal slate
#

yes, but when declared in the autoload, the same thing happens but in the hud script

burnt blade
verbal slate
#

I declare the signal in the global script, and the hud script should emit that when a button is pressed, but it the signal's not declared at that scope, even though it's a global script.

burnt blade
#

If you want it declared on the autoload like that then do all the connecting in the autoload

verbal slate
#

This happens when the button's pressed

#

otherwise no problems (button doesn't work still)

burnt blade
#

That’s why you’re seeing that error

#

You’re trying to pass a parameter to a signal that has no parameters

#

Should just be Globals.save_pressed.emit()