# Move an AI with an "onclicked" button

**URL:** <https://forums.unrealengine.com/t/move-an-ai-with-an-onclicked-button/404275>\
**Category:** UI\
**Tags:** ai-navigation, unreal-engine, onclicked, Widget, Blueprint, question\
**Created:** [September 11, 2017, 7:24am UTC](https://forums.unrealengine.com/t/move-an-ai-with-an-onclicked-button/404275 "2017-09-11T07:24:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fniii](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fniii](https://forums.unrealengine.com/u/Fniii)\
**Post date:** [September 11, 2017, 7:24am UTC](https://forums.unrealengine.com/t/move-an-ai-with-an-onclicked-button/404275/1 "2017-09-11T07:24:13Z")

</div>

Hi everybody, I warn I am a noob ^^  
Everything is in the title, I created a widget with a button and I would like my AI to follow me when I press it.  
I tried it like this :

[https://i.imgur.com/Jn9nlrG.png](https://i.imgur.com/Jn9nlrG.png)

But it could not be that simple and obviously it does not work. Someone To help me in my learning? 🙂

---

<div class="post-metadata">

**Author:** ![Iotti](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Iotti](https://forums.unrealengine.com/u/Iotti)\
**Post date:** [September 11, 2017, 8:43pm UTC](https://forums.unrealengine.com/t/move-an-ai-with-an-onclicked-button/404275/2 "2017-09-11T20:43:26Z")

</div>

There is a lot of ways to do that, but here is one:

- On your character, create a function that makes your AI to follow the character as you want
- On Widget, reference your character (you may use GetPlayerCharacter or create a var on it and instance when you put the widget on viewport ) and call that function.

---

<div class="post-metadata">

**Author:** ![Fniii](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fniii](https://forums.unrealengine.com/u/Fniii)\
**Post date:** [September 12, 2017, 11:02pm UTC](https://forums.unrealengine.com/t/move-an-ai-with-an-onclicked-button/404275/3 "2017-09-12T23:02:31Z")

</div>

Hi, thanks for your reply, I tried to put an AIMoveTo on a function of my character but I can not, I tried with “Follow” also but it did not work (not sure to have done well ). Why can not I use the “AIMoveTo” directly on my widget?

---

<div class="post-metadata">

**Author:** ![Iotti](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Iotti](https://forums.unrealengine.com/u/Iotti)\
**Post date:** [September 13, 2017, 12:57am UTC](https://forums.unrealengine.com/t/move-an-ai-with-an-onclicked-button/404275/4 "2017-09-13T00:57:20Z")

</div>

The AIMoveTo requires an AIController to work on it, but also, your pawn needs a movement component to do that. Does your pawn controlled by AI has one?

---

<div class="post-metadata">

**Author:** ![Fniii](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fniii](https://forums.unrealengine.com/u/Fniii)\
**Post date:** [September 13, 2017, 1:54am UTC](https://forums.unrealengine.com/t/move-an-ai-with-an-onclicked-button/404275/5 "2017-09-13T01:54:27Z")

</div>

he dont, but I managed with AIMoveTo using a boolean on the widget … Now my problem is that all my AI (same BP) follow me when I press the button …

---

<div class="post-metadata">

**Author:** ![yung23athome](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@yung23athome](https://forums.unrealengine.com/u/yung23athome)\
**Post date:** [November 3, 2021, 12:07am UTC](https://forums.unrealengine.com/t/move-an-ai-with-an-onclicked-button/404275/6 "2021-11-03T00:07:31Z")

</div>

can you extrapolate on how you used a boolean on the widget ?
