# Is there a way to uniquely identify a player in a custom verse script

**URL:** <https://forums.unrealengine.com/t/is-there-a-way-to-uniquely-identify-a-player-in-a-custom-verse-script/766558>\
**Category:** Programming & Scripting\
**Tags:** unreal-editor-for-fortnite, fortnite\
**Created:** [February 8, 2023, 5:05pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-uniquely-identify-a-player-in-a-custom-verse-script/766558 "2023-02-08T17:05:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rory\_REDGamesCo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rory_redgamesco/32/634990_2.png) [@Rory\_REDGamesCo](https://forums.unrealengine.com/u/Rory_REDGamesCo)\
**Post date:** [February 8, 2023, 5:05pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-uniquely-identify-a-player-in-a-custom-verse-script/766558/1 "2023-02-08T17:05:55Z")

</div>

We are looking to track data for a **player** on a custom verse device but they do not seem consistently comparable between separate verse triggers. For example using map where the **player** is the key will not find the same **player** in a subsequent look up in the same map for a different triggering call.

Is there a different way to consistently know a **player** is the same via some other method? Getting unique ID or Player Name?

---

<div class="post-metadata">

**Author:** ![AxelCapek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/axelcapek/32/950074_2.png) [@AxelCapek](https://forums.unrealengine.com/u/AxelCapek)\
**Post date:** [February 8, 2023, 8:49pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-uniquely-identify-a-player-in-a-custom-verse-script/766558/2 "2023-02-08T20:49:31Z")

</div>

I have used player maps successfully to uniquely separate players. Admittedly I haven’t tested in the recent patch, though. There’s also the chance something else is going wrong with the code…🙂 Could you share how you are doing so?

---

<div class="post-metadata">

**Author:** ![Rory\_REDGamesCo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rory_redgamesco/32/634990_2.png) [@Rory\_REDGamesCo](https://forums.unrealengine.com/u/Rory_REDGamesCo)\
**Post date:** [February 8, 2023, 10:15pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-uniquely-identify-a-player-in-a-custom-verse-script/766558/3 "2023-02-08T22:15:12Z")

</div>

Here is a simple map that is a counter for players. Separately, I have another device that references this device and calls GetPlayerData to get the map data.

```auto
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /EpicGames.com/Temporary/Diagnostics }

log_simple_player_data_device := class(log_channel){}

simple_player_data_device := class(creative_device)
{

    Logger:log = log{Channel:=log_simple_player_data_device}

    @editable PlayerTrigger:trigger_device = trigger_device{}

    var PlayerData : [player]int = map{}
    var Counter:int = 0;

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
    {
        PlayerTrigger.TriggeredEvent.Subscribe(OnTriggered)
    }

    OnTriggered(TriggerPlayer:player):void=
    {
        set Counter = Counter +1
        if(set PlayerData[TriggerPlayer] = (Counter))
        {
            Logger.Print("Set Counter For Player: {Counter}")
        }
        else
        {
            Logger.Print("Setting Counter for player failed: {Counter}")
        }
    }

    GetPlayerData<public>(QueryPlayer:player):int=
    {
        if(Count := PlayerData[QueryPlayer])
        {
            Logger.Print("Player Found: {Count}")
            return Count
        }
        else
        {
            Logger.Print("Player NOT Found:")
            return -1
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![AxelCapek](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/axelcapek/32/950074_2.png) [@AxelCapek](https://forums.unrealengine.com/u/AxelCapek)\
**Post date:** [February 8, 2023, 11:32pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-uniquely-identify-a-player-in-a-custom-verse-script/766558/4 "2023-02-08T23:32:21Z")

</div>

On this part of your code:

```auto
set Counter = Counter +1
        if(set PlayerData[TriggerPlayer] = (Counter))

```

Could you try:

```auto
set Counter = Counter +1
        if(CurrentPlayerCounter := set PlayerData[TriggerPlayer] = (Counter))

```

Does this fix your issue?

---

<div class="post-metadata">

**Author:** ![Rory\_REDGamesCo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rory_redgamesco/32/634990_2.png) [@Rory\_REDGamesCo](https://forums.unrealengine.com/u/Rory_REDGamesCo)\
**Post date:** [February 8, 2023, 11:39pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-uniquely-identify-a-player-in-a-custom-verse-script/766558/5 "2023-02-08T23:39:06Z")

</div>

I will give that a try. But it does look like this might be an instance of this issue with two custom devices referencing each other acting like different instances  
[https://forums.unrealengine.com/t/blocker-custom-devices-local-variables-are-reset-when-called-from-another-device/766865](https://forums.unrealengine.com/t/blocker-custom-devices-local-variables-are-reset-when-called-from-another-device/766865)
