# Differentiating between players

**URL:** <https://forums.unrealengine.com/t/differentiating-between-players/1688327>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [February 14, 2024, 2:33pm UTC](https://forums.unrealengine.com/t/differentiating-between-players/1688327 "2024-02-14T14:33:46Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sebzy0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebzy0](https://forums.unrealengine.com/u/sebzy0)\
**Post date:** [February 14, 2024, 2:33pm UTC](https://forums.unrealengine.com/t/differentiating-between-players/1688327/1 "2024-02-14T14:33:46Z")

</div>

I am trying to teleport a player after that player kills another player. I want to make the teleport on elimination only for the player from AllPlayers[0]. How do I do this, thanks?

```auto
using {/Fortnite.com/Characters}
using {/Fortnite.com/Devices}
using {/Fortnite.com/Playspaces}
using {/Fortnite.com/UI}
using {/Fortnite.com/Game}

using {/UnrealEngine.com/Temporary/Diagnostics}
using {/UnrealEngine.com/Temporary/SpatialMath}
using {/UnrealEngine.com/Temporary/UI}

using {/Verse.org/Colors}
using {/Verse.org/Colors/NamedColors}
using {/Verse.org/Random}
using {/Verse.org/Simulation}

teleport_mechanics_device := class(creative_device):

    @editable
    TeleportToClutch : teleporter_device = teleporter_device {}

    @editable
    TeleportToEnemy1 : teleporter_device = teleporter_device {}

    @editable
    TeleportToEnemy2 : teleporter_device = teleporter_device {}

    @editable
    TeleportToEnemy3 : teleporter_device = teleporter_device {}

    @editable
    TeleportToEnemy4 : teleporter_device = teleporter_device {}

    OnBegin<override>()<suspends>:void=
        
        Playspace: fort_playspace = GetPlayspace()
        AllPlayers: []player = Playspace.GetPlayers()
        r := GetRandomInt(1,2)
        
        for (EliminationGamePlayer : AllPlayers):
            if (ClutchPlayer := EliminationGamePlayer.GetFortCharacter[]):
                ClutchPlayer.EliminatedEvent().Subscribe(OnPlayerEliminated)
        Sleep(15.0)

        if (AllPlayers.Length = 1):
            if (ClutchPlayer: player = AllPlayers[0]):
                TeleportToClutch.Teleport(ClutchPlayer)
        
        else if (AllPlayers.Length = 2):
            if(r = 1):
                if (ClutchPlayer: player = AllPlayers[0]):
                    TeleportToClutch.Teleport(ClutchPlayer)
                if (EnemyPlayer1: player = AllPlayers[1]):
                    TeleportToEnemy1.Teleport(EnemyPlayer1)

            else:
                if (ClutchPlayer: player = AllPlayers[1]):
                    TeleportToClutch.Teleport(ClutchPlayer)
                if (EnemyPlayer1: player = AllPlayers[0]):
                    TeleportToEnemy1.Teleport(EnemyPlayer1)

    
    

    OnPlayerEliminated(Result:elimination_result):void=
        EliminatingCharacter := Result.EliminatingCharacter

        if (FortCharacter := EliminatingCharacter?):
            if (EliminatingAgent := FortCharacter.GetAgent[]):
                    TeleportToClutch.Teleport(EliminatingAgent)

```

---

<div class="post-metadata">

**Author:** ![Starkiller9229](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Starkiller9229](https://forums.unrealengine.com/u/Starkiller9229)\
**Post date:** [February 15, 2024, 6:24pm UTC](https://forums.unrealengine.com/t/differentiating-between-players/1688327/2 "2024-02-15T18:24:27Z")

</div>

If I’m understanding correctly then you only want to teleport the player if that player is the player at AllPlayers[0].

Agents are comparable so in your OnPlayerEliminated you can retrieve the Player at AllPlayers[0] and compare it to EliminatingAgent.

---

<div class="post-metadata">

**Author:** ![sebzy0](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@sebzy0](https://forums.unrealengine.com/u/sebzy0)\
**Post date:** [February 22, 2024, 9:32pm UTC](https://forums.unrealengine.com/t/differentiating-between-players/1688327/3 "2024-02-22T21:32:45Z")

</div>

how would i do this in the code? or do i need a code for it?

---

<div class="post-metadata">

**Author:** ![Starkiller9229](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Starkiller9229](https://forums.unrealengine.com/u/Starkiller9229)\
**Post date:** [February 23, 2024, 6:48am UTC](https://forums.unrealengine.com/t/differentiating-between-players/1688327/4 "2024-02-23T06:48:09Z")

</div>

Include the comparison in the if before you Teleport the player

```auto
if (EliminatingAgent := FortCharacter.GetAgent[], FirstAgent := AllPlayers[0], EliminatingAgent = FirstAgent):

```

I hope this helps 🙂
