If you plan on having more than 2 players in your map, I recommend using a map type, which can match each reference with a player. Here is documentation and a tutorial on maps:
https://dev.epicgames.com/documentation/en-us/uefn/map-in-verse
,
Here is an example snippet of how you would set a map up and register players:
@editable Refs : []player_reference_device = array{}
var RefMap : [player]player_reference_device = map{}
RegisterPlayers (): void =
Players := GetPlayspace().GetPlayers()
for(Index -> Player : Players):
if(Ref := Refs[Index]):
if(set RefMap[Player] = Ref):
Ref.Enable()
Ref.Register(Player)
Print("Assigned Player Ref {Index}")
What this does is match each player with a player reference from your Refs array, then store both of them in RefMap. Refs is an array of all your player ref devices, make sure the devices do not start enabled, so only assigned ones turn on. Now, as long as you have an Agent or Player reference, you can get RefMap[Player] and it will return the reference device that the player is registered to. Just make sure that whenever a player joins or leaves the game you call the RegisterPlayers function to update and make sure the new player gets a reference.