Uncaught TypeError: Cannot read properties of undefined (reading 'on')

Hello, as I was finalizing our game, I ran into an error where it said " Uncaught TypeError: Cannot read properties of undefined (reading ‘on’)".

Attached below this paragraph is my character next to an object that they should have collided with, yet the collision or like the interaction between the character and the object never happened.

Character interacting with object

Here is a screenshot of what the error looked like upon launching.

And here is a screenshot of where the error takes me to in my script. I am not sure what it meant when it cannot define ‘on’.
Collision script

Some sort of enlightenment or help would be very much appreciated. Thank you!

Hi @Ramm! It looks like your entity has no collision component. You can check this in the editor.

Hello @Albertos!

Thank you for your response. But my character and the entities its supposed to interact with all have applied collisions.

Attached below is a screenshot of the character’s settings panel.

I think it can also be that you destroy an entity while the event listener is still active.

I am aware that the entity is the object I am supposed to collide with but which part here is the event listener?

Do you destroy an entity by script? If so, please check the manual page below.


Hello, @Albertos!

I read and tried to troubleshoot with the help of peers and it seems that an issue could be that the script isn’t attached to the entity, yet, when I checked again, it is applied. In fact all entities that trigger the event have collisions attached to them so I am unsure anymore on what to do.

I am actually bit afraid to readjust the script because this is the only running issue left on the game and I don’t have enough time to troubleshoot it. If it could help further explain my issues, I will be linking the game below. Thank you in advance.


This entity (‘DLG BOX’) has the collision script but no collision component

Found this via the Smart Search tool that can search for entities that have the script attached to it


It worked! Thank you so much. This helped me a lot in my project.