# Error in GLTFloader through this.scene.add()

**URL:** <https://discourse.threejs.org/t/error-in-gltfloader-through-this-scene-add/39944>\
**Category:** Questions\
**Tags:** javascript\
**Created:** [July 3, 2022, 7:40pm UTC](https://discourse.threejs.org/t/error-in-gltfloader-through-this-scene-add/39944 "2022-07-03T19:40:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eytanm](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/eytanm/32/27729_2.png) [@Eytanm](https://discourse.threejs.org/u/Eytanm)\
**Post date:** [July 3, 2022, 7:40pm UTC](https://discourse.threejs.org/t/error-in-gltfloader-through-this-scene-add/39944/1 "2022-07-03T19:40:12Z")

</div>

Hello,  
I’m new to threeJS, but trying to learn.  
I have this code saved in App.js

```javascript
class App {

    init() {
        this.renderer = new WebGLRenderer( { alpha:true,antialias: true } );
        this.renderer.setPixelRatio( window.devicePixelRatio );
        this.renderer.outputEncoding = sRGBEncoding;
        this.renderer.shadowMap.enabled = true;

        this.scene = new Scene()
        this.camera = new PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 5000 );
        this.clock = new Clock()

        const loader = new GLTFLoader();
        loader.load( 'https://rawcdn.githack.com/mrdoob/three.js/7249d12dac2907dac95d36227d62c5415af51845/examples/models/gltf/Flamingo.glb',
            function ( gltf ) {        
                this.scene.add( gltf.scene );
            }
        )

```

I get this error:  
**Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘scene’)**  
I know this is something with the scope but could not figure this out:/  
Please help

---

<div class="post-metadata">

**Author:** ![panda\_warrior](https://avatars.discourse-cdn.com/v4/letter/p/ed655f/32.png) [@panda\_warrior](https://discourse.threejs.org/u/panda_warrior)\
**Post date:** [July 3, 2022, 8:10pm UTC](https://discourse.threejs.org/t/error-in-gltfloader-through-this-scene-add/39944/2 "2022-07-03T20:10:47Z")

</div>

Try changing it to an arrow function:

```javascript
const loader = new GLTFLoader();
        loader.load( 'https://rawcdn.githack.com/mrdoob/three.js/7249d12dac2907dac95d36227d62c5415af51845/examples/models/gltf/Flamingo.glb',
             ( gltf ) => {        
                this.scene.add( gltf.scene );
            }
        )

```

---

<div class="post-metadata">

**Author:** ![Eytanm](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/eytanm/32/27729_2.png) [@Eytanm](https://discourse.threejs.org/u/Eytanm)\
**Post date:** [July 4, 2022, 5:47am UTC](https://discourse.threejs.org/t/error-in-gltfloader-through-this-scene-add/39944/3 "2022-07-04T05:47:54Z")

</div>

perfect. thanks @panda_warrior !!
