help on showing score

Godot Version

4.2.2

Question

Hi, I created a game in Godot for the first time, it’s a very simple game that during the phase if the character eliminates the enemies he gains some points that stay on the score counter, so I wanted to show this score on the final screen but I’m not able to If anyone knows how to help I would be grateful.

Project settings > Autoload

Add

Globals

globals.gd:

var score = 0

When you are adding score:

Globals.score += enemy_value # or whatever you use

When you want to display the score on the end screen:

func _ready():
  $FinalScoreLabel.text = str(Globals.score)
1 Like