Issues regarding Player Macro to select targets for GM

Hello, I have implemented a script macro that automatically targets tokens within range. However, I need the macro to target the tokens for the GM. Here is the line of code that I’ve been using to implement this functionality on my local instance of Foundry:

game.users.getName("UndyingEmbers").updateTokenTargets(target_ids);

However, even when I, the GM, is logged in, the macro doesn’t update the targets for the GM. Does anyone have any potential solutions or explanations as to why this works on Foundry and not Forge? Any help is greatly appreciated!

Note: For clarification, the macro runs and updates targets if I’m the one executing it. The macro does not update targets if a player is the one who executes it.