This should do the trick (you'll obviously want to get rid of the chat logging and the event triggers if it's going inside another script): on('ready', () => { const hpBar = 'bar1_value' // change this if it isn't where you store HP on(`change:token:${hpBar}`, (obj, prev) => { sendChat('api', 'bar2 change detected'); if (parseInt(obj.get(hpBar)) < 1) { // check that token dropped to 0 or less HP let turnOrder = (Campaign().get('turnorder')) ? JSON.parse(Campaign().get('turnorder')) : []; // "turnorder" is a string, and can be empty if (turnOrder.length < 1) return sendChat('api', 'turnorder is empty'); // exit if turn order is empty log(turnOrder); turnOrder.forEach((token, index) => { if (token.id === obj.id) { turnOrder.splice(index, 1); // remove current turnorder entry if it matches the token id that lost HP Campaign().set('turnorder', JSON.stringify(turnOrder)); // re-stringify before setting modified turnorder sendChat('api', `${obj.get('name')} removed from turn order`) } else sendChat('api', `${obj.id} not found in turn order`); }) } }); }); I'm not sure what system you're playing, but worth noting that in 5e this will remove a player when they get knocked out. They'd need to be added back to the turn order as soon as they're healed. May not be relevant to what you're playing. If the script does anything apart from removing turn order entries, you'd probably want to remove the early return if (turnorder.length < 1), as an empty array is perfectly valid for adding entries to. More info here .