[SOLVED] Making A Health Bar Tutorial, BUT

Ive made the script right and everything works out until u launch… When u launch the health bar appears below your body and doesnt follow the camera:


But when im in the editor it works just fine:
18%20PM%20-%20Edited
Here ive looked for the problem for the past 2-3 hours and cant seem to find ANY problem and ik how to do this but something is off but eberything checks out if anyone can find an issue let me know

var Health = pc.createScript('health');

// initialize code called once per entity
Health.prototype.initialize = function() {
    this.app.keyboard.on(pc.EVENT_KEYDOWN, this.onKeyDown, this);
    this.app.keyboard.on(pc.EVENT_KEYUP, this.onKeyUp, this);
    this.scaling = 0;
    this.add = 0.25;
    this.subtract = -0.1;
    this.initialScale = this.entity.getLocalScale();
    this.cameraEntity = this.app.root.findByName('CameraPlayer');
    
};

// update code called every frame
Health.prototype.update = function(dt) {
    var currentScale = this.entity.getLocalScale();
    
    if (currentScale.x < 0.01)
        {
            currentScale.x = 0;
        }
    if (currentScale.x > 50)
        {
            currentScale.x = 50;
            this.scaling = 0;
        }
    
        {
            this.scaling = 0;
        }
    currentScale.x -= this.scaling;
    this.entity.setLocalScale(currentScale);
};

because im gonna take a break ill be back soon if u can help i thank u very much!
Nathan Hawkins!
https://playcanvas.com/editor/scene/722434

Do you mean in the editor itself or when you launch the scene to test from editor? Can you post a link to a public project that shows this issue please?

https://playcanvas.com/editor/scene/722434

As far as I can tell, the health bar is not in the camera view:

image

Click launch then look at the screen and u will see. Dont move the camera when u launch

Just looks like this to me:

18%20PM%20-%20Edited
Looks like this for me

@yaustar Now it should be completely gone right? even if u look around its not there? Fixed now ty

Looks fine now

2020202

Yup ty for your help