HELP! Cannot read properties of undefined (reading 'teleport')

It’s for a shoot bullet script. We’re making an fps game in class and I copied the script provided to us. Seemed to work on everyone else but mine keeps saying it cant read ‘teleport’

Here’s the shootbullet script:

var ShootBullet = pc.createScript(‘shootBullet’);

ShootBullet.attributes.add(‘bulletEmitter’, {

// initialize code called once per entity
ShootBullet.prototype.initialize = function() {


// update code called every frame
ShootBullet.prototype.update = function(dt) {
if ( {
//retrieve the bullet template from the asset window
var BulletFromTheAsset =;
//make the bullet appear on stage
var BulletInstance = BulletFromTheAsset.resource.instantiate();
//make the bulletInstance a child of the root;

    //get the position of the bulletEmitter
    var BulletPosition = this.bulletEmitter.getPosition();
    //teleport the bulletInstance to the bulletPosition

    //retrieve the Vec3 coordinates, which refers to xyz axis (gizmo)
    this.force = new pc.Vec3();
    //retrieve the z axis
    //scale the z axis to 800
    //apply force to the BulletInstance


Please help :smiling_face_with_tear:

Hi @biiaaa and welcome,

Most likely the following entity that you are instantiating doesn’t have a rigidbody component, try to debug that:

var BulletInstance = BulletFromTheAsset.resource.instantiate();