0 votes

Plz help! I have no idea what to do, and this make me insane. Godot just don't wanna see my node. I was trying to code this by many variant, but nothing is working. By the way it's problem not alone in my project. If you help me, you probably help me to finish my game. THX.
CODE:
extends Control

func fail():

var scr
var HUD = load("res://hud.gd").new()
scr = HUD.score
get_node(".../Score").set_text("SCORE: "+str(scr))

func _ready():
pass

NODE TREE:
Node2D->Controll->Panel->Score

in Engine by (12 points)

1 Answer

+1 vote

".../Score" is not a valid node path. If you're trying to get a node that's a sibling of this one, you would use "../Score". ".." means "the node above this one". "..." has no meaning.

You also don't need to use set_text() btw. Properties are accessible directly.

get_node("../Score").text = "SCORE: "+str(scr)
by (20,897 points)

Thx! It's working!

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.