# How do I get the player reference from the player spawner?

**URL:** <https://forums.unrealengine.com/t/how-do-i-get-the-player-reference-from-the-player-spawner/920719>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [April 13, 2023, 2:27pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-player-reference-from-the-player-spawner/920719 "2023-04-13T14:27:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AddisonV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/addisonv/32/642498_2.png) [@AddisonV](https://forums.unrealengine.com/u/AddisonV)\
**Post date:** [April 13, 2023, 2:27pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-player-reference-from-the-player-spawner/920719/1 "2023-04-13T14:27:21Z")

</div>

I am trying to create a team manager that tracks the player respawn location and if it has been to long after it passed a certain checkpoint. But i don’t know how to create the player ref, i know there is a player type, but the spawner event returns me an agent type and i can’t convert it to the player. Event if it is the agent type i need, i can’t seem to get any available functions or variables to use from this agent.

```auto
using { /Fortnite.com/Devices }
using { /Verse.org/Native }
using { /Verse.org/Simulation }

team1_manager := class(creative_device):

    @editable
    Player1SpawnPad : player_spawner_device := player_spawner_device {}
    @editable
    Player2SpawnPad:player_spawner_device := player_spawner_device {}

    # Getting a player reference
    var PlayerScriptReference:?player = false

    # Runs when this device_script is started in a running game
    OnBegin<override>()<suspends>:void=
        Player1SpawnPad.SpawnedEvent.Subscribe(HandlePlayerSpawned)

    HandlePlayerSpawned(SpawnedPlayer:agent):void=
        # Get the player reference

        set PlayerScriptReference = option{SpawnedPlayer}
   

```

This is what i currently have.

---

<div class="post-metadata">

**Author:** ![Resykz](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/resykz/32/677389_2.png) [@Resykz](https://forums.unrealengine.com/u/Resykz)\
**Post date:** [April 13, 2023, 4:43pm UTC](https://forums.unrealengine.com/t/how-do-i-get-the-player-reference-from-the-player-spawner/920719/2 "2023-04-13T16:43:53Z")

</div>

I beleive this is what you’re after:

> [@Agent to Player](https://forums.unrealengine.com/t/agent-to-player/883843/2):
>
> player inherits from agent. So you should be able to attempt to cast to player to see if the provided agent is in fact a player instance. Example: if (Player := player[Agent]): # Do something with Player here now that we know this is in fact a Player type
