How to detect who(Player Controller) clicked on the actor

I have been playing around with the blueprint scripting system of UE4 for some time and I find it rather fun to mess with. Recently I met with the problem that I have described in the title. I am makin a small RTS like game where I have a castle which is placed in the world and when the level loads so does the castle blueprint. When loading the castle blueprint sets a castle owner enum variable by detecting the closest(using collision sphere to detect that) player:

A bit messy but bear with me(accepting opninions about ways to make it better).
After that during the gameplay when the player clicks on the castle I want the castle blueprint to check which player clicked on it. If it is a player with the same value of the enum variable it should display the castle HUD for him, if not - do nothing. Here is my try to do that:

Pretend the PrintString bluepring is the HUD. :slight_smile:
I would appreciate if someone could just give me a direction.
By the way the enum variable has 4 states - Player1, Payer2, Neutral and Unknown.

1 Like

Just to make an update. Before when I asked this question I didn’t understand how exactly things should have been working. So the answer here is:

I should not have used the castle to detect who clicked it but by using the player controller I should’ve detected what was clicked with the mouse by using GetHitResultUnderCursorByChannel.