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

asked Jul 1 in Projects by Jasper (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)
answered Jul 1 by kidscancode (17,164 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.