"Invalid access to property or key 'value' on a base object of type 'int'."

Godot 4.3 (steam)

I was following a tutorial from youtube on how to make a stamina bar for mi character. when I finished and tried to run the scene it will close and will give me the error on the topic name, I tried tweaking everything but its always the same “Invalid access to property or key ‘value’ on a base object of type ‘int’.”

Here is the code, error is in line 14:

extends Control
@onready var stamina = $TextureProgressBar
@export var can_regen:  = false
@export var time_to_wait = 1.5
@export var s_timer = 0
@export var can_start_stimer = true
# Called when the node enters the scene tree for the first time.
func _ready():
	stamina = 100

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta) :
#stamina regen
	if can_regen == false && stamina.value != 100 or stamina.value == 0:
		can_start_stimer = true
		if can_start_stimer:
			s_timer += delta
			if s_timer >= time_to_wait:
				can_regen = true
				can_start_stimer = false
				s_timer = 0
	if stamina.value == 100:
		can_regen = false

	if can_regen == true:
		stamina.value += 0.5
		can_start_stimer = false
		s_timer = 0

Could not figure how to fix it

This is a good issue to see how the error message is telling you what’s wrong.

Re-read the error message. Look at line 14. Like at line 2. Then look at line 19. Can you see what’s missing?

Keywords are: “property”, “value”, “type ‘int’”.

If you find what’s wrong. Take a bit of time to understand what it means. This will help alot in the long run.

Perhaps you wanted to use stamina.value = 100 here.

I kept trying, turns out there was a problem with the path the variable was trying to get the value from, fixed it already!