# loadAsync function not working or using wrong

**URL:** <https://discourse.threejs.org/t/loadasync-function-not-working-or-using-wrong/28355>\
**Category:** Questions\
**Tags:** loaders\
**Created:** [July 26, 2021, 1:02pm UTC](https://discourse.threejs.org/t/loadasync-function-not-working-or-using-wrong/28355 "2021-07-26T13:02:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luuk123](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/luuk123/32/19704_2.png) [@Luuk123](https://discourse.threejs.org/u/Luuk123)\
**Post date:** [July 26, 2021, 1:02pm UTC](https://discourse.threejs.org/t/loadasync-function-not-working-or-using-wrong/28355/1 "2021-07-26T13:02:24Z")

</div>

I am trying to get a promise from the loadAsync function so that I can use the async, await technique to instansiate an object in my scene. But the problem is that the promise is always pending and that the promiseResult property undefined is. What am I doing wrong? I think I have to specify something else as the return value but after reading the documentation I still don’t know what I am doing wrong. See code below:

```javascript
async function loadCar() {
    var gltfLoader = new THREE.GLTFLoader();
    var loader = new THREE.Loader(gltfLoader);
    var promise = loader.loadAsync("car/scene.gltf");
    console.log(promise);
    var result = await promise;
    console.log(result);
}

```

---

<div class="post-metadata">

**Author:** ![donmccurdy](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/donmccurdy/32/33209_2.png) [@donmccurdy](https://discourse.threejs.org/u/donmccurdy)\
**Post date:** [July 26, 2021, 4:09pm UTC](https://discourse.threejs.org/t/loadasync-function-not-working-or-using-wrong/28355/2 "2021-07-26T16:09:36Z")

</div>

The `THREE.Loader` class is never used directly, it’s a base class for other loaders. Instead:

```javascript
var gltfLoader = new THREE.GLTFLoader();
var result = await loader.loadAsync("car/scene.gltf");
...

```

---

<div class="post-metadata">

**Author:** ![Luuk123](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/luuk123/32/19704_2.png) [@Luuk123](https://discourse.threejs.org/u/Luuk123)\
**Post date:** [July 27, 2021, 12:32pm UTC](https://discourse.threejs.org/t/loadasync-function-not-working-or-using-wrong/28355/3 "2021-07-27T12:32:07Z")

</div>

I think you ment:

```javascript
var gltfLoader = new THREE.GLTFLoader();
var result = await gltfLoader.loadAsync("car/scene.gltf");
...

```

Because that seems to work 😃  
Thanks for your working solution!
