the error is cant define clone of null, but this exact code was working perfectly an hour ago any ideas\
var Spawner = pc.createScript('spawner');
// initialize code called once per entity
Spawner.prototype.initialize = function() {
this.Spawner = 0;
this.spawnedMonster = 0;
};
// update code called every frame
Spawner.prototype.update = function(dt) {
this.Spawner += dt;
if (this.Spawner > 5 && this.spawnedMonster < 1) {
this.spawnedMonster = 1;
this.Spawner = 0;
var Monster1 = this.app.root.findByName('Monster1');
var F = Monster1.clone();
Monster1.parent.addChild(F);
F.rigidbody.teleport(-12, 1, -4);
}
if (this.Spawner > 15 && this.spawnedMonster < 2 ) {
this.spawnedMonster = 2;
this.Spawner = 0;
var Monster2 = this.app.root.findByName('Monster1');
this.G = Monster2.clone();
Monster2.parent.addChild(this.G);
this.G.rigidbody.teleport(-12, 1, -4);
}
};