# Type 'sprite' not assignable to type 'number' error

**URL:** https://forum.makecode.com/t/type-sprite-not-assignable-to-type-number-error/42251
**Category:** Help
**Created:** [February 19, 2026, 11:44pm UTC](https://forum.makecode.com/t/type-sprite-not-assignable-to-type-number-error/42251 "2026-02-19T23:44:57Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![SouperMediocre1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/soupermediocre1/32/22579_2.png) [@SouperMediocre1](https://forum.makecode.com/u/SouperMediocre1)
#### Post date: [February 19, 2026, 11:44pm UTC](https://forum.makecode.com/t/type-sprite-not-assignable-to-type-number-error/42251/1 "2026-02-19T23:44:57Z")

</div>

created a new variable, set it to an already existing sprite. variable not used anywhere else in the project but it is giving an error. pretty sure it shouldn’t be.

(I am trying to make chess)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/e/3e0c2326910b81cc255b095fe2912e8d8d15d0fb.png)

---

<div class="post-metadata">

### Author: ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)
#### Post date: [February 20, 2026, 6:28pm UTC](https://forum.makecode.com/t/type-sprite-not-assignable-to-type-number-error/42251/2 "2026-02-20T18:28:59Z")

</div>

Can you share your project? I cannot see any issues with your screenshot, so it’s probably an issue somewhere else.

---

<div class="post-metadata">

### Author: ![SouperMediocre1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/soupermediocre1/32/22579_2.png) [@SouperMediocre1](https://forum.makecode.com/u/SouperMediocre1)
#### Post date: [February 20, 2026, 8:14pm UTC](https://forum.makecode.com/t/type-sprite-not-assignable-to-type-number-error/42251/3 "2026-02-20T20:14:21Z")

</div>

as I explained in the post, it isn’t an error somewhere else in the project because I know for a fact that I just made the variable. but since posting this I already figured out the issue. you can workaround the bug by setting the variable to a new sprite then destroying it immediately at the start of the game.

also If I did share the project it would not help because I reworked this part of code and I dont use the variable anymore anyways

---

<div class="post-metadata">

### Author: ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)
#### Post date: [February 20, 2026, 8:18pm UTC](https://forum.makecode.com/t/type-sprite-not-assignable-to-type-number-error/42251/4 "2026-02-20T20:18:29Z")

</div>

the reason why this doesnt work is that you are defining an array of arrays, not an array of sprites. (i would use the cotacentate block in the betterarrays extension to join the arrays of sprites into one array)

search for it here:[https://awesome-arcade.vercel.app/extensions](https://awesome-arcade.vercel.app/extensions)

---

<div class="post-metadata">

### Author: ![SouperMediocre1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/soupermediocre1/32/22579_2.png) [@SouperMediocre1](https://forum.makecode.com/u/SouperMediocre1)
#### Post date: [February 23, 2026, 9:14pm UTC](https://forum.makecode.com/t/type-sprite-not-assignable-to-type-number-error/42251/5 "2026-02-23T21:14:15Z")

</div>

that still isn’t the reason why though, because I was using a nested loop to get the values within the array that was within the array. value2 was a sprite in the screenshot. - also if that were the case, then setting the variable to a sprite in “on start” wouldn’t fix the issue.
