# Is it possible to attach a variable to an player itself? (Verse)

**URL:** <https://forums.unrealengine.com/t/is-it-possible-to-attach-a-variable-to-an-player-itself-verse/1327152>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, question, fortnite\
**Created:** [October 9, 2023, 1:33pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-attach-a-variable-to-an-player-itself-verse/1327152 "2023-10-09T13:33:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![LyssaSugarNya](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lyssasugarnya/32/722321_2.png) [@LyssaSugarNya](https://forums.unrealengine.com/u/LyssaSugarNya)\
**Post date:** [October 9, 2023, 1:33pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-attach-a-variable-to-an-player-itself-verse/1327152/1 "2023-10-09T13:33:36Z")

</div>

Hello, I have been wondering if you can give individual players a variable in verse… Like giving them a class of their own. Like, when a player presses a specific button that player will be given a variable exclusive for that player alone in verse.

---

<div class="post-metadata">

**Author:** ![summergrrrl](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/summergrrrl/32/979572_2.png) [@summergrrrl](https://forums.unrealengine.com/u/summergrrrl)\
**Post date:** [October 10, 2023, 5:21pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-attach-a-variable-to-an-player-itself-verse/1327152/2 "2023-10-10T17:21:32Z")

</div>

Hi @LyssaSugarNya , do you have a specific example in mind? You can create a map where the player is the key and you specify what value you want associated with the player.

For example:

```auto
player_info := class:
    # Data to associate with player goes here
    var MyData:float = 0.0

my_device := class(creative_device):
    # Map between player type and player_info class created above.
    var PlayerInfoMap:[player]player_info = map{}

```

You can learn more about map at [Map](https://dev.epicgames.com/documentation/en-us/uefn/map-in-verse)

---

<div class="post-metadata">

**Author:** ![EV\_WAKA](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EV\_WAKA](https://forums.unrealengine.com/u/EV_WAKA)\
**Post date:** [October 10, 2023, 8:10pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-attach-a-variable-to-an-player-itself-verse/1327152/3 "2023-10-10T20:10:38Z")

</div>

I read somewhere that classes needed the specifier to be used in maps. Does this code work for you regardless?

---

<div class="post-metadata">

**Author:** ![summergrrrl](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/summergrrrl/32/979572_2.png) [@summergrrrl](https://forums.unrealengine.com/u/summergrrrl)\
**Post date:** [October 11, 2023, 6:42pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-attach-a-variable-to-an-player-itself-verse/1327152/4 "2023-10-11T18:42:16Z")

</div>

You don’t need a specifier to use classes in a map but if you’re using a class as the key to a map it must be comparable as stated in the documentation for map [Map](https://dev.epicgames.com/documentation/en-us/uefn/map-in-verse). Do you remember where you read that?

---

<div class="post-metadata">

**Author:** ![EV\_WAKA](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EV\_WAKA](https://forums.unrealengine.com/u/EV_WAKA)\
**Post date:** [October 12, 2023, 9:05pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-attach-a-variable-to-an-player-itself-verse/1327152/5 "2023-10-12T21:05:33Z")

</div>

I’m sorry I left out which specifier. It was the \*unique specifier i was referring to. This was explained on a Youtube tutorial I watched.

---

<div class="post-metadata">

**Author:** ![LoPing](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/loping/32/737300_2.png) [@LoPing](https://forums.unrealengine.com/u/LoPing)\
**Post date:** [October 12, 2023, 10:42pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-attach-a-variable-to-an-player-itself-verse/1327152/6 "2023-10-12T22:42:25Z")

</div>

I do this all the time, and generally end up initializing the map on the player spawned event which entails having an @editable array of player spawners in your device. And since UEFN/Verse is new and still in the not-totally-predictable stage, it’s worth saying that maps work as advertised.

I do custom classes and attach them to the players and this turns out to be useful for many functions.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [November 11, 2023, 10:43pm UTC](https://forums.unrealengine.com/t/is-it-possible-to-attach-a-variable-to-an-player-itself-verse/1327152/7 "2023-11-11T22:43:07Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
