# How can I track a player? Is the agent instance unique to the player?

**URL:** <https://forums.unrealengine.com/t/how-can-i-track-a-player-is-the-agent-instance-unique-to-the-player/827835>\
**Category:** Programming & Scripting\
**Tags:** unreal-editor-for-fortnite, question, fortnite\
**Created:** [March 27, 2023, 3:51pm UTC](https://forums.unrealengine.com/t/how-can-i-track-a-player-is-the-agent-instance-unique-to-the-player/827835 "2023-03-27T15:51:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![User-16333ec50b](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@User-16333ec50b](https://forums.unrealengine.com/u/User-16333ec50b)\
**Post date:** [March 27, 2023, 3:51pm UTC](https://forums.unrealengine.com/t/how-can-i-track-a-player-is-the-agent-instance-unique-to-the-player/827835/1 "2023-03-27T15:51:56Z")

</div>

I am trying to create a simple creature kill counter to start learning the scripting language however, I cannot seem to access the index of my map - it always returns false on assignment.

Below is the code:

```
# Load player profile and give weapons
OnPlayerSpawn(InPlayer : agent) : void =
    if (set PlayerKillCounts[InPlayer] = PlayerStruct { CreatureEliminations := 0 }):
        if(SpawnItemGranter:item_granter_device := ItemGranters[0]):
            SpawnItemGranter.GrantItem(InPlayer)

# Increase kill count
OnCreatureElimination(InPlayer : ?agent) : void =
    if (InPlayer?):
        if (Player:PlayerStruct := PlayerKillCounts[InPlayer]):
            if (set PlayerKillCounts[InPlayer?] = PlayerStruct { CreatureEliminations := Player.CreatureEliminations +1 }):
                # TODO: Spawn another
        else:
            Print("Could not find player")

# Holds player data
var PlayerKillCounts : [agent]PlayerStruct = map{}

# Configure game
OnBegin<override>()<suspends>:void=
    for (Spawner : PlayerSpawners):
        Spawner.SpawnedEvent.Subscribe(OnPlayerSpawn)

    if(CreaturePlacer:creature_placer_device := CreaturePlacers[0]):
        CreaturePlacer.EliminatedEvent.Subscribe(OnCreatureElimination)

```

I always receieve “Could not find player” in the “LOG” tab when in session (start game) after a kill. I can’t figure out how to debug what is inside of the “InPlayer” object other than the fact it is an agent (that I would expect is the same as I got on the player spawner)

Any help appreciated, my struct looks like this:

PlayerStruct := struct:  
CreatureEliminations : int
