Score System

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SamMC35
:warning: Old Version Published before Godot 3 was released.

I am modifying the pong example given in the Godot Documentation. But I can’t add a score system.

This is what I’m doing. The following code is in the game.gd

#When adding score    
get_node("Score_Label").set_text(str(opponent_score))

The result is :

str_text is a null instance

Please help.

:bust_in_silhouette: Reply From: avencherus

The most likely cause, given the limited information, is that your get_node() path is incorrect.

Try print(get_node("Score_Label")) and verify you’re indeed getting a label.

Also, check the debugger, remote inspector to get the scene structure and see if the node trying to get the label has a child node called exactly Score_Label.

eons | 2017-04-03 01:02