Get specific agent instead of all players

Hey there,
I currently have an array for the player spawners in my code & also already made a function for that array: PlayerSpawnHandler(Agent : agent):void=.

Now I have these lines of code that I want to convert to just get a specific agent that spawns instead of getting all players again on the island:

    AllPlayers := GetPlayspace().GetPlayers()
    for (Player : AllPlayers, FortCharacter := Player.GetFortCharacter[]):
        if (set PlayerMap[Player] = 0, WeaponTier := PlayerMap[Player]):
            FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated)
            GrantWeapon(Player, WeaponTier)

Can somebody help me to get a specific agent instead of all ones?
Greetings!

Well, I’m pretty sure the player type is comparable, which means you could do :

for (Player : AllPlayers, Player = MY_TARGET_PLAYER):
    # Will trigger 0 or 1 time

You don’t show which player you want exactly so I can’t help you more.
Also just as a note, I think that giving any sort of “admin” role to a player is forbidden, but maybe someone could back me up on this.

Ooh, I didn’t meant it like that, I apologize!

I don’t want a specific player in general with a name or something like that, I just want the player that for example in this code spawns on a player spawner device, because
I’m working on a gungame map, but it only works when players spawn at the round start, but it don’t work when a player joins an ongoing session

I’m sorry I don’t understand either, if you want the player that spawns through the PlayerSpawnHandler(Agent : agent):void= function, then your player is the Agent variable, which can be cast as player calling player[Agent] in a failure context.

But maybe I’m just dumb too :man_shrugging:

Hey i am super lost right now and saw that you understand PlayerMaps so i thought i would ask you. I am triing to get the tracker Value only for the the Player playing right now but it switches betwen all players (i only tried it with two) showing my tracked value and the my enemies would be souper happy over some help :slight_smile:

this is my code:
OnBegin():void =

    loop: 
        for. Player : (GetPlayspace().GetPlayers())
        do:
            TargetValue := Tracker.GetValue(Player)
            Print("Tracker is at {TargetValue}")