Why doesn`t my logic work in UE5? I need to get one bot to run after another.

Why doesn`t my logic work in UE5? I need to get one bot to run after another.
The logic is in the screenshot below. The bot should run after another bot (Hero) when it comes into its field of view (Pawn sensing is installed), but this does not work. But if you put a player instead of Hero, it will work. Why is that?

Hey there @RealShmell! Welcome to the community! It’s likely that your pawn sensing is only looking for players! Check and see if this is checked on:
image

Let me know you have any questions!

I turned it off, but it still doesnt work. Hero running by in front of the bot and bot doesnt see him.

No worries, we can do some actual debugging with it. That’s just a common issue I thought could have been it.

So, head back over to your BP, and put a print between the pawnsensing and the cast, have it print what the pawn sensing sees. (this will print EVERY pawn it sees, this is to verify it can even see your other AI). Then, put a print node behind the cast fail and succeed for your casts. Print “Cast Succeed” or “Cast Failed” this is just to verify if the cast failed or your logic after the fact does.

Scenarios:
If the Pawnsensing fails to see your AI at all, you’ll have to go check your Pawn Sensing details, as well as check your AI’s collision settings. It has to be visible, and it also has to be a pawn.

If the Pawnsensing can see and passes the correct pawn over, it’s likely the cast that’s failing or the logic.

Cast fails? You might need to make sure that you’re casting to the correct class.

Cast succeeds? It’s your logic that is likely the problem, slap a print on the AI moveto Success and Fail and let’s see where that goes.

I did that you told me and the bot still didnt see anyone. I created a new bot and inserted the logic from the first bot into it. That didnt help before but now it works. Why is it so? Could it be because of problems in the UE engine version (I have 5.0.3)?
But I forgot one important thing: the logic is in the bot, not in the AI controller and I need to connect query filter to bot. How can I connect query filter to the bot or connect Pawn Sensing to the AI Controller to make the whole logic work?

The way I handle it is to just keep a reference to the player controller and call the functions that can only run there directly.