Hi folks, I'm trying to relearn the javascript in Roll20 APIs. I had made some progress in 2020-2021 but have forgotten it all. I'm trying right now to run a script to pull a selected character token's name. I based the following on a google inquiry. It works just fine when I've selected a player character token or a token that is not associated with a character. However, it gives me TypeError: Cannot read properties of undefined (reading '0') right after the log "Starting ______ New" and before the let chatcommand line. I don't understand why it happens there. So why does the first getObj line snuff up? And how can I handle or avoid such an error? Code is simple, I think, I have a lot of Logs to it: on("chat:message", function(msg) { log("Starting ______ New"); //Convert what is typed to lowercase and trim. let chatcommand = msg.content.trim().toLowerCase(); log("After convert msg to lower case"); if(msg.type == "api" && chatcommand.startsWith("!test")) { log("immediately after if statement"); let token = getObj("graphic", msg.selected[0]._id); log("token defined"); let char = getObj("character", token.get("represents")); log("character defined"); if(char) { log("if(char) part"); let charName = char.get("name"); log(charName); } else { log("else part"); // Token is null (not found) log("Not a character token"); } } }); Thanks for any help on this. -- Tim