0 votes

i have an instance not in the scene and a label in the scene
and i want to increment the score when it spwans

var pipe =preload("res://pipe.tscn").instance
pipe.connect("pipe", label,"plusscore")

and in the label i
func plusscore()

in Engine by (17 points)

1 Answer

0 votes

Your code is broken. Use code sample button for your code.
enter image description here

You wrote pipe.connect("pipe", label,"plusscore")
pipe doesn't sound like a signal name to me. If pipe is a signal, did you declare/emit it?

pipe.gd which attached to pipe.tscn

extends Node

signal pipe

Every time you pipe.emit_signal("pipe"), plus_score() is called.

Also, why don't you just label.plus_score()?

by (300 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.