when I run this code in the start function the HealthBar object stops being rendered it still exists but it's not showing,My HealthBar object is disappearing when I run this code in the Start() function

Transform healthBar = HealthBar.GetComponent();
healthBar.localScale = new Vector3(maxHealth, 0, 0);
currentHealth = maxHealth;
,

Transform healthBar = HealthBar.GetComponent();
healthBar.localScale = new Vector3(maxHealth, 0, 0);
currentHealth = maxHealth;

Try setting 1 as scale for Y and Z, 0 will make it not visible.

healthBar.localScale = new Vector3(maxHealth, 1, 1);

Change zero values in Vector3. Give higher values for Y and Z. 0 make it dissapear.

ooooh duh. I feel very dumb right now