Hi! I'm trying to write a script that finds an event that matches a text variable and sets its I.D as its own variable. This is the code I'm trying to use. It keeps saying 'cannot read property 'id' of undefined.
Code:
const char = $dataMap.events.find(e => e && e.name == $gameVariables.value(10)).id;
if (char) $gameVariables.setValue(9, char.id);