# fort\_playspace.GetPlayers() not working

**URL:** <https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710>\
**Category:** Issues and Bug Reporting\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [March 24, 2023, 6:28pm UTC](https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710 "2023-03-24T18:28:15Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![TriviaTroy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TriviaTroy](https://forums.unrealengine.com/u/TriviaTroy)\
**Post date:** [March 24, 2023, 6:28pm UTC](https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710/1 "2023-03-24T18:28:15Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/b/5/7b51278f327f550c9ac50edb134aa9cc049e5c6c.png)

Getting Script error 3506: Unknown member ‘GetPlayers’ in ‘type(fort\_playspace, fort\_playspace)’. But I’ve properly imported playspace and it is listed as a member. Is this a bug or am I misunderstanding something?

---

<div class="post-metadata">

**Author:** ![\_umbug](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@\_umbug](https://forums.unrealengine.com/u/_umbug)\
**Post date:** [March 24, 2023, 6:38pm UTC](https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710/2 "2023-03-24T18:38:29Z")

</div>

maybe you missed the brackets after the namespace maybe?

Fort\_playspace().

still learning myself

---

<div class="post-metadata">

**Author:** ![TriviaTroy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TriviaTroy](https://forums.unrealengine.com/u/TriviaTroy)\
**Post date:** [March 24, 2023, 6:50pm UTC](https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710/3 "2023-03-24T18:50:36Z")

</div>

Nope that doesn’t work.

Its so weird. GetPlayers() is clearly a public method under fort\_playspace.

---

<div class="post-metadata">

**Author:** ![wiktorwiktor121](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@wiktorwiktor121](https://forums.unrealengine.com/u/wiktorwiktor121)\
**Post date:** [March 24, 2023, 7:24pm UTC](https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710/4 "2023-03-24T19:24:26Z")

</div>

you do GetPlayspace().GetPlayers()

---

<div class="post-metadata">

**Author:** ![TriviaTroy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TriviaTroy](https://forums.unrealengine.com/u/TriviaTroy)\
**Post date:** [March 24, 2023, 7:38pm UTC](https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710/5 "2023-03-24T19:38:56Z")

</div>

This worked but ONLY when its under the OnBegin function. Guess it doesn’t have the context until it starts?

---

<div class="post-metadata">

**Author:** ![DustinREDGames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dustinredgames/32/634988_2.png) [@DustinREDGames](https://forums.unrealengine.com/u/DustinREDGames)\
**Post date:** [March 24, 2023, 7:42pm UTC](https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710/6 "2023-03-24T19:42:06Z")

</div>

Returns an array of players:  
`var players : []player = Self.GetPlayspace().GetPlayers()`

And to loop thru that array:

```auto
for(X -> Player : players):
    # do stuff....

```

---

<div class="post-metadata">

**Author:** ![Leden](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/leden/32/713014_2.png) [@Leden](https://forums.unrealengine.com/u/Leden)\
**Post date:** [April 8, 2023, 12:32am UTC](https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710/7 "2023-04-08T00:32:54Z")

</div>

Hey Dustin, late reply here but I’d like to get a quick explanation to help me understand better:

On your answer here everything kinda worked, except that I wasn’t able to use the “Player” variable you used in your for loop, only the “X” one, which leads to the key index (not what I want, I’d like to read values of that array)

Here’s the error I get when trying to retrieve the “Player” variable:

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/c/03ca3308c564eecbdd74c5b148b7318805f8515f.png)

---

<div class="post-metadata">

**Author:** ![DustinREDGames](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dustinredgames/32/634988_2.png) [@DustinREDGames](https://forums.unrealengine.com/u/DustinREDGames)\
**Post date:** [April 10, 2023, 2:21pm UTC](https://forums.unrealengine.com/t/fort-playspace-getplayers-not-working/817710/8 "2023-04-10T14:21:18Z")

</div>

For loop works like this:

```auto
for(Index -> SingleElement : Array):
    # do stuff....

```

Without seeing the rest of your code, I’m just guessing, but maybe you are trying to Log print a `player` type, which has to convert to a `string` to print, but can’t.
