# Assigning Player Variable

**URL:** <https://forums.unrealengine.com/t/assigning-player-variable/2234574>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [December 21, 2024, 12:40am UTC](https://forums.unrealengine.com/t/assigning-player-variable/2234574 "2024-12-21T00:40:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![user\_2391a52d2637615794c23ba4e8f20318a9bff299b82748a7a7e741](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@user\_2391a52d2637615794c23ba4e8f20318a9bff299b82748a7a7e741](https://forums.unrealengine.com/u/user_2391a52d2637615794c23ba4e8f20318a9bff299b82748a7a7e741)\
**Post date:** [December 21, 2024, 12:40am UTC](https://forums.unrealengine.com/t/assigning-player-variable/2234574/1 "2024-12-21T00:40:27Z")

</div>

How do I set a variable of type player to a player from an array of all of the players created like this:  
var AllPlayers:player = GetPlayspace().GetPlayers()

I really don’t understand the whole accessing with a failure thing.

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [December 21, 2024, 6:23am UTC](https://forums.unrealengine.com/t/assigning-player-variable/2234574/2 "2024-12-21T06:23:47Z")

</div>

I dont get the question you want to add a player to the array?

if so that would be `set AllPlayers = AllPlayers + array{PlayerHere}`

It’s not really a map where you set a value of a player which does need failure prevention

---

<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:** [December 22, 2024, 8:57am UTC](https://forums.unrealengine.com/t/assigning-player-variable/2234574/3 "2024-12-22T08:57:15Z")

</div>

You need to iterate through this array, and probably read some more of that documentation
