0 votes

I am having trouble calling a function from one Node into another. This is the code to call a player clock in a chess game:

var clock = get_tree().get_root().get_node("Chess/PlayerClock")

This is the code in the clock Node

extends Label

func pause_clock():
    print("CLOCK PAUSED!")

The output is simply:


I also tried


With the same result. Does anyone know why the function is not called?


in Engine by (14 points)

1 Answer

0 votes

you don't need to call additional get_script()
just try clock.pause_clock()

by (9,754 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 Frequently asked questions and 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.