Go From PlayerID to Player?

I need to select a player with a trigger command like this: /trigger trigger_pay_player set {playerid}

In Tick Function:

execute as @a[scores={trigger_pay_player=0..}] run function namespace:pay_player

Pay_Player Function:

# Storing playerid I inputed into the trigger cmd, into test scoreboard
execute store result score @s test run scoreboard players get @s trigger_pay_player
# Reset trigger
scoreboard players set @s trigger_pay_player 0

scoreboard players operation @s bank -= @s pay_amount

scoreboard players operation @a[scores={playerid=test}] bank += @s pay_amount

In the last line, the target data doesn't work @a[scores={playerid=test}] I'm trying to select a player with the playerid stored in score "test". Is there a way to do this?

Continue to help post