Unable to loop through Player Array

I want to loop through the Player Array for a ready button. The array is populated and the For Loop runs but doesn’t put out anything.

While searching for a solution I found out that I could get elements from the array with the Random function but not with the Get function.

What is happening?

If random works, and get doesn’t, then you’re supplying an out of bound index to the get node.

Also, don’t always rely on the debugger. Sometimes it will say one thing, but printing the output will tell you something else.

I’m using the index provided by random for the get function, that should result in the same item from the array. Printing the output results in an empty string.

The loop goes through the array and prints the correct index but doesn’t print out the player state.

output

Ah, sorry, not a clear picture.

I can tell you that the GET will not use the same index as the RANDOM, because you are in fact calling it twice.

This, for instance, won’t work:

Even so, I agree, it should choose a valid index, but it will probably not be the same one.

1 Like

I tested it in the first person template and added a gamestate blueprint, a loop and started it with two players. The loop runs twice but doesn’t give the player state.

I found the problem, it is a bug in UE5

1 Like