You need to implement healthBar by moving the child green rectangle relative to the red parent.
PS Please do not offer other options, I know about them, you need this way.
PSS MB code help, which is now
SliderRect.transform.localScale = new Vector3 ( currentHealth / maxHealth, 1.1f, 1); if(SliderRect.transform.localPosition.x == 0f) { SliderRect.transform.localPosition = new Vector3 (-(1 - (currentHealth / maxHealth)), 0,- 0.001f); }