How to make Progress Bar keep its progress when changing levels

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By stella3321

Hi, so my issue is that I have a progress bar in my game that changes value when the player picks up an item, but the progress on how many items have been picked up gets reset everytime the player changes scenes. I have already made an autoload global script to keep track of the Item amount but this doesn’t appear to have changed anything.

this is the autoload script:

        extends Node
    var Items = 0
    func _ready():

This is the progress bar script:

    extends CanvasLayer

func _physics_process(delta):
	if Autoload.Items == 0:

func _on_Item_pick_up():
	Autoload.Items = Autoload.Items + 1
	$itemprogress/itembar.value = Autoload.Items

Any help is appreciated.Thanks

In your progress bar script add a ready function then set the bar value like $itemprogress/itembar.value = Autoload.Items.
You can write this Autoload.Items = Autoload.Items + 1 as Autoload.Items += 1

Enfyna | 2023-05-30 17:00