Score Code

My script for game score is not working it keeps on saying that “Cannot read properties of undefined (reading ‘name’)”

Here’s my code:

Hi @Pixels,

Your code seems correct, any chance sharing a sample project that reproduces the issue to take a look?

Here’s the link for my game PlayCanvas | HTML5 Game Engine

Game seems to work for me, no error, I was able to collect two keys.