# Custom Player Map

**URL:** <https://forums.unrealengine.com/t/custom-player-map/1791518>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [April 6, 2024, 10:20pm UTC](https://forums.unrealengine.com/t/custom-player-map/1791518 "2024-04-06T22:20:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lowfpsplayer1](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lowfpsplayer1/32/1094555_2.png) [@lowfpsplayer1](https://forums.unrealengine.com/u/lowfpsplayer1)\
**Post date:** [April 6, 2024, 10:20pm UTC](https://forums.unrealengine.com/t/custom-player-map/1791518/1 "2024-04-06T22:20:40Z")

</div>

var PlayersMap: [player]CustomPlayerData = map{}  
How would I access this in a separate class?

---

<div class="post-metadata">

**Author:** ![ifraser](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ifraser](https://forums.unrealengine.com/u/ifraser)\
**Post date:** [June 20, 2024, 3:11pm UTC](https://forums.unrealengine.com/t/custom-player-map/1791518/2 "2024-06-20T15:11:48Z")

</div>

This example is assuming one file, and is very simple.

```auto
player_tracker := class():
    var PlayersMap: [player]custom_player = map{}

another_class := class():
    PlayerTracker:player_tracker =player_tracker {}

    OnStart():void=
        PlayersMap := PlayerTracker.PlayersMap

```

You will need to take into account for the Access Specifiers of the member you are trying to access in another class. This can get more complicated with multiple files and modules.

This documentation will help:

> **[Specifiers and Attributes | Unreal Editor for Fortnite Documentation | Epic...](https://dev.epicgames.com/documentation/en-us/uefn/specifiers-and-attributes-in-verse)**
>
> Learn about specifiers and attributes, and how to apply additional semantics and behavior to your Verse code.

A simple example is adding the private specifier here means that you cannot use PlayersMap outside of player\_tracker.

```auto
player_tracker := class():
    # cannot be accessed outside of this class
    var<private> PlayersMap: [player]custom_player = map{}

```

After you get this working, to continue to improve your knowledge and skills I would consider thinking about making this map private, and instead you should expose public functions that can be used instead.

Ask yourself what are the common ways another class is using the PlayerMap, is it just to ask if a player exists, and to get the custom\_player class instance? You can make those public functions.  
Maybe adding/removing a player should only be done within this class, or maybe you want that to be public functions for another system to control.  
It will evolve over time, and you want to encapsulate logic to be easily re-used, and hidden from things that shouldn’t need to know. That way you can change how things work later without affecting other systems that use it.
