# \[SOLVED\] Cannot check "image number" of "closest instance of (sprite-type) to (sprite), error message comes out

**URL:** https://community.thunkable.com/t/solved-cannot-check-image-number-of-closest-instance-of-sprite-type-to-sprite-error-message-comes-out/3043266
**Category:** Issues / Bugs
**Tags:** solved, help
**Created:** [June 5, 2024, 4:28pm UTC](https://community.thunkable.com/t/solved-cannot-check-image-number-of-closest-instance-of-sprite-type-to-sprite-error-message-comes-out/3043266 "2024-06-05T16:28:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![elias.villa.8320](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elias.villa.8320](https://community.thunkable.com/u/elias.villa.8320)
#### Post date: [June 5, 2024, 4:28pm UTC](https://community.thunkable.com/t/solved-cannot-check-image-number-of-closest-instance-of-sprite-type-to-sprite-error-message-comes-out/3043266/1 "2024-06-05T16:28:45Z")

</div>

I am making a DNA repair game, I am trying to check if the base pair you clicked is mutated or not.  
to do this I want to check the “clicked component” and the image number of the closest DNA\_type (the complementary base), but as soon as I put this in an “if” or “set variable” block an error message pops up ----\>“Internal error generating code for blocks”

this is the game [Thunkable](https://x.thunkable.com/projectPage/666052d07dbb720a26dc0582)

this is the problematic code

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/b/f/bf39b2bff2491b902d96ae78479f3dd2a96dae56.png)

what can I do to avoid this bug? Maybe some alternative method for getting the value.  
Thanks in advance.

P.S the ± 1 in the “if” is because the image number of pairs is either the one after or before, I put 2 unused images between pairs so they wouldn’t clash, I use the “is even” to know which one to generate.  
1=A  
2=T  
3=UNUSED  
4=UNUSED  
5=G  
6=C

---

<div class="post-metadata">

### Author: ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)
#### Post date: [June 5, 2024, 6:16pm UTC](https://community.thunkable.com/t/solved-cannot-check-image-number-of-closest-instance-of-sprite-type-to-sprite-error-message-comes-out/3043266/2 "2024-06-05T18:16:07Z")

</div>

I’m not sure why that’s giving an error but you can often get around those type mismatches by assigning the offending value to a variable and then using that variable to complete the sequence of blocks, like this:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/4/7446d1d6a19df1f485642672509625906eaac302.png)

---

<div class="post-metadata">

### Author: ![elias.villa.8320](https://avatars.discourse-cdn.com/v4/letter/e/f05b48/32.png) [@elias.villa.8320](https://community.thunkable.com/u/elias.villa.8320)
#### Post date: [June 5, 2024, 9:21pm UTC](https://community.thunkable.com/t/solved-cannot-check-image-number-of-closest-instance-of-sprite-type-to-sprite-error-message-comes-out/3043266/3 "2024-06-05T21:21:01Z")

</div>

Yeah, this solved it. Still If I had a nickel for every bug with block interactions this week, I’d have 2 nickels, which isn’t alot but it’s weird that it happened twice.

---

<div class="post-metadata">

### Author: ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)
#### Post date: [June 7, 2024, 10:50am UTC](https://community.thunkable.com/t/solved-cannot-check-image-number-of-closest-instance-of-sprite-type-to-sprite-error-message-comes-out/3043266/4 "2024-06-07T10:50:43Z")

</div>


