fort_playspace.GetPlayers() not working

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?

maybe you missed the brackets after the namespace maybe?

Fort_playspace().

still learning myself

Nope that doesn’t work.

Its so weird. GetPlayers() is clearly a public method under fort_playspace.

you do GetPlayspace().GetPlayers()

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

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

And to loop thru that array:

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

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

For loop works like this:

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.