# Cannot read properties of undefined reading (reading 'chachedIR')

**URL:** https://forum.makecode.com/t/cannot-read-properties-of-undefined-reading-reading-chachedir/20727
**Category:** Help
**Tags:** game
**Created:** [June 19, 2023, 5:04pm UTC](https://forum.makecode.com/t/cannot-read-properties-of-undefined-reading-reading-chachedir/20727 "2023-06-19T17:04:39Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![5d-code](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/5d-code/32/9238_2.png) [@5d-code](https://forum.makecode.com/u/5d-code)
#### Post date: [June 19, 2023, 5:04pm UTC](https://forum.makecode.com/t/cannot-read-properties-of-undefined-reading-reading-chachedir/20727/1 "2023-06-19T17:04:39Z")

</div>

i have a function:

```auto
function makePlayer(img: Image, id: number, walkSpeed: number, jumpHeight: number, init: (plr: Player) => void): Player {
    let plr = {
                sprite: sprites.create(img, SpriteKind.Player),
                id: id,
                _walkSpeed: walkSpeed,
                _jumpHeight: jumpHeight,

                get jumpHeight(): number {
                    return plr._jumpHeight;
                },

                set jumpHeight(val: number) {
                    plr._jumpHeight = val;
                },

                get walkSpeed(): number {
                    return plr._walkSpeed;
                },

                set walkSpeed(val: number) {
                    plr._walkSpeed = val;
                    controller.moveSprite(plr.sprite, plr._walkSpeed, 0);
                },

                initialize: function (): void {
                    plr.sprite.ay = 350;
                    plr.walkSpeed = walkSpeed;
                    plr.jumpHeight = jumpHeight;

                    init(plr);
                },

                grounded: function (): boolean {
                    return plr.sprite.vy == 0;
                },

                jump: function (): void {
                    if (!plr.grounded()) return;
                    plr.sprite.vy -= plr.jumpHeight;
                },

                cameraFollow: function (): void {
                    scene.cameraFollowSprite(plr.sprite);
                }
    }
    
    return plr;
}

```

BRUH I DONT EVEN HAVE THE GOOFY BRUH CHACHED IR ANYWHERE IN MA CODEEEEE 😭 😭 😭 😭 😭 😭 😭 😭

---

<div class="post-metadata">

### Author: ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)
#### Post date: [June 19, 2023, 5:51pm UTC](https://forum.makecode.com/t/cannot-read-properties-of-undefined-reading-reading-chachedir/20727/2 "2023-06-19T17:51:15Z")

</div>

Sorry, could you post the full code (or project link, that would be easier) since it seems your code is accessing the `Player` class which is not present here, and I would need some more context to solve this issue

---

<div class="post-metadata">

### Author: ![5d-code](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/5d-code/32/9238_2.png) [@5d-code](https://forum.makecode.com/u/5d-code)
#### Post date: [June 22, 2023, 5:00pm UTC](https://forum.makecode.com/t/cannot-read-properties-of-undefined-reading-reading-chachedir/20727/3 "2023-06-22T17:00:35Z")

</div>

solution: dont use object literals, use classes. makecode just doesnt like it
