Can't pass ?agent as an argument due to "no rollback" and "decides effect"

You’re basically trying to call a no_rollback function GrantItem() at the same time as a decides in the same line which is not possible. Instead, do the if check for the optional first then pass that as the argument

if ( Agent := Target?):
    ItemGranter.GrantItem(Agent)
1 Like