Cannot read property 'meshInstances' of undefined

Appreciate If someone could help me out on this. I’ve imported a car model and want to code keyboard control that if user press A it will change to red color press S it will change to original color. I got the keyboard control but can’t figure it out why it keep pop up errors like meshInstance undefined.

https://playcanvas.com/editor/scene/523804

This is the project it was public project.

Regards,
Leeming

You’ve got keyboardInput script attached to camera as well.
Then it tries to get model from camera entity (script executes against entities it is attached to), and of course fails.

Please use debugging: https://developer.playcanvas.com/en/user-manual/scripting/debugging/ which is essential for developer to investigate their running code and errors.