# Is there a way to compare two agent variables to check if they are the same player?

**URL:** <https://forums.unrealengine.com/t/is-there-a-way-to-compare-two-agent-variables-to-check-if-they-are-the-same-player/1159991>\
**Category:** Devices\
**Tags:** fortnite-creative, unreal-editor-for-fortnite, question, fortnite\
**Created:** [May 9, 2023, 10:26am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-compare-two-agent-variables-to-check-if-they-are-the-same-player/1159991 "2023-05-09T10:26:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julianoz1224](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/julianoz1224/32/698263_2.png) [@Julianoz1224](https://forums.unrealengine.com/u/Julianoz1224)\
**Post date:** [May 9, 2023, 10:26am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-compare-two-agent-variables-to-check-if-they-are-the-same-player/1159991/1 "2023-05-09T10:26:28Z")

</div>

I need to check if two saved Player (agent) variables are the same person.

```auto
if(Player1 <> CurrentLeader):
   Print("New Leader")

```

This example and many other methods I have tried don’t work, as it always fails. Is there a way to do this?

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [May 14, 2023, 10:49pm UTC](https://forums.unrealengine.com/t/is-there-a-way-to-compare-two-agent-variables-to-check-if-they-are-the-same-player/1159991/2 "2023-05-14T22:49:39Z")

</div>

This is strange, I’m pretty sure it works, `agent`, `player` and `fort_character` are comparable which mean they can be compared and used as Indexes for maps which I do all the times.

You should check your code again, maybe your Player1 is not really the CurrentLeader after all 🤔

---

<div class="post-metadata">

**Author:** ![NeonDeekx](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/neondeekx/32/940093_2.png) [@NeonDeekx](https://forums.unrealengine.com/u/NeonDeekx)\
**Post date:** [May 24, 2024, 1:38am UTC](https://forums.unrealengine.com/t/is-there-a-way-to-compare-two-agent-variables-to-check-if-they-are-the-same-player/1159991/3 "2024-05-24T01:38:59Z")

</div>

Find a fix?
