# Noticed something weird with loop index

**URL:** <https://forums.unrealengine.com/t/noticed-something-weird-with-loop-index/56916>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [March 1, 2016, 4:15pm UTC](https://forums.unrealengine.com/t/noticed-something-weird-with-loop-index/56916 "2016-03-01T16:15:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paploo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@paploo](https://forums.unrealengine.com/u/paploo)\
**Post date:** [March 1, 2016, 4:15pm UTC](https://forums.unrealengine.com/t/noticed-something-weird-with-loop-index/56916/1 "2016-03-01T16:15:35Z")

</div>

Hey there, I noticed something really strange today with loop index or maybe I’m don’t really follow how loops and their index work. But anyway, in the first image, I set my loop index from 0 - 1 to create 2 players and i am setting the return value to a playercontroller array and later with 2 gets, I set my playercontroller1 and playercontroller2. (This is for local multiplayer game). The “Get” with index 0 doesn’t return anything, whereas the “Get” with index 1, returns one of the 2 playercontroller spawned.

In the 2nd image, I changed my loop index to 1-2 and its returns value for both “Get”. Is there a reason why it doesn’t return anything on my “Get” with index 0, when I have my loop index set from 0-1?

 ![a77d813a675941eb8594215dbfb2cd0d31c7e5a4.jpeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/7/7/a77d813a675941eb8594215dbfb2cd0d31c7e5a4.jpeg) ![a8d98591afb2574d3818391851be944c23920462.jpeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/d/a8d98591afb2574d3818391851be944c23920462.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f54268a3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f54268a3](https://forums.unrealengine.com/u/anonymous_user_f54268a3)\
**Post date:** [March 1, 2016, 4:36pm UTC](https://forums.unrealengine.com/t/noticed-something-weird-with-loop-index/56916/2 "2016-03-01T16:36:56Z")

</div>

It really depends on the array that you are looping on and at what indexes the controllers were assigned. It should start at zero, not 1 or that would be really confusing.

---

<div class="post-metadata">

**Author:** ![paploo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@paploo](https://forums.unrealengine.com/u/paploo)\
**Post date:** [March 1, 2016, 4:42pm UTC](https://forums.unrealengine.com/t/noticed-something-weird-with-loop-index/56916/3 "2016-03-01T16:42:44Z")

</div>

> [@mikepurvis;484628](#):
>
> It really depends on the array that you are looping on and at what indexes the controllers were assigned. It should start at zero, not 1 or that would be really confusing.

In my case when I start my loop index from 0, it returns “none”, sadly.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f54268a3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f54268a3](https://forums.unrealengine.com/u/anonymous_user_f54268a3)\
**Post date:** [March 1, 2016, 4:53pm UTC](https://forums.unrealengine.com/t/noticed-something-weird-with-loop-index/56916/4 "2016-03-01T16:53:13Z")

</div>

Yes, but that has everything to do with the array you are looping. It is valid for something to be set to none.

---

<div class="post-metadata">

**Author:** ![paploo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@paploo](https://forums.unrealengine.com/u/paploo)\
**Post date:** [March 1, 2016, 5:27pm UTC](https://forums.unrealengine.com/t/noticed-something-weird-with-loop-index/56916/5 "2016-03-01T17:27:14Z")

</div>

I figured it out. The first player controller is spawned by default, which is assigned the id 0. The ‘Create Player’ node fails to return a valid player controller for loop index 0.
