# How can I change a location of multiple objects with a loop?

**URL:** <https://forums.unrealengine.com/t/how-can-i-change-a-location-of-multiple-objects-with-a-loop/481648>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [April 9, 2021, 9:19am UTC](https://forums.unrealengine.com/t/how-can-i-change-a-location-of-multiple-objects-with-a-loop/481648 "2021-04-09T09:19:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![K\_O\_N\_N\_A\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@K\_O\_N\_N\_A\_1](https://forums.unrealengine.com/u/K_O_N_N_A_1)\
**Post date:** [April 9, 2021, 9:19am UTC](https://forums.unrealengine.com/t/how-can-i-change-a-location-of-multiple-objects-with-a-loop/481648/1 "2021-04-09T09:19:54Z")

</div>

Hey, I am a beginner when it comes to working in Unreal Engine 4. I can’t seem to figure out how could I increment a value within a loop. I have an array of objects which are popping out of the ground when stepping on a trigger. They do pop out of the ground but are all overlapping. So, how could I change their relative position with a loop? I only need to move them to the side.

(Say that element 0 has position 0,0,0 and element 1 would have position 0,5,0 etc.)

Thank you for the help!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [April 9, 2021, 10:43am UTC](https://forums.unrealengine.com/t/how-can-i-change-a-location-of-multiple-objects-with-a-loop/481648/2 "2021-04-09T10:43:09Z")

</div>

What about:

 ![335364-screenshot-1.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/1/0/e1072cde9934cc65220ba9036a8935e02729a51b.jpeg)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [April 9, 2021, 12:10pm UTC](https://forums.unrealengine.com/t/how-can-i-change-a-location-of-multiple-objects-with-a-loop/481648/3 "2021-04-09T12:10:06Z")

</div>

> an array of objects which are popping  
> out of the ground when stepping on a  
> trigger

I’ll just add that it is often easier and more efficient to attach all those elements to another dummy scene component and then move said component instead.

May not be applicable, though. Depends on the context. Sounds like a trap full of spikes.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5ebdf999](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5ebdf999](https://forums.unrealengine.com/u/anonymous_user_5ebdf999)\
**Post date:** [April 9, 2021, 12:50pm UTC](https://forums.unrealengine.com/t/how-can-i-change-a-location-of-multiple-objects-with-a-loop/481648/4 "2021-04-09T12:50:34Z")

</div>

To increase a value using a loop you can use the “array index” and a multiplier OR set a variable with each loop.

 ![335373-increment.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/e/d/6ede2a8b767f647fff8f31a5688524a498fe04b5.png)

---

<div class="post-metadata">

**Author:** ![K\_O\_N\_N\_A\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@K\_O\_N\_N\_A\_1](https://forums.unrealengine.com/u/K_O_N_N_A_1)\
**Post date:** [April 9, 2021, 1:27pm UTC](https://forums.unrealengine.com/t/how-can-i-change-a-location-of-multiple-objects-with-a-loop/481648/5 "2021-04-09T13:27:59Z")

</div>

This did exactly what I wanted, thank you!

---

<div class="post-metadata">

**Author:** ![Zondyz](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Zondyz](https://forums.unrealengine.com/u/Zondyz)\
**Post date:** [April 9, 2021, 2:19pm UTC](https://forums.unrealengine.com/t/how-can-i-change-a-location-of-multiple-objects-with-a-loop/481648/6 "2021-04-09T14:19:19Z")

</div>

U can usa interp to! It take the input value and slowy decreases it by one at the time / deltaspeed, and you can stop it when u want
