[SOLVED] Continuous Firing Problem

I want to get my player to shoot bullets continuously, but I can’t add anything to the scene hierarchy inside a setInterval function.
https://playcanvas.com/editor/code/539704?tabs=11863399&line=27&col=26&

Create timer variable in init function.

In update function increase it. And check, is it equal to, for example, 1000. If is, make shoot and reset your counter.

Shootstuff.prototype.initialize = function() {
    this.timer = 0;
};
Shootstuff.prototype.update = function(dt) {
    this.timer +=dt;
    if (this.timer >=1000) { 
          this.shoot(); 
          this.timer = 0; 
    }
}

And sure, you need shoot function.

Fixed it. Thanks for the help!