Differentiating between players

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?

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)

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.

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

Include the comparison in the if before you Teleport the player

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

I hope this helps :slight_smile: