How to shoot ray in specific direction? Top-down shooter

I’m trying to draw a debug line of certain length starting at my pawn position and moving in direction of mouse click, but I keep getting really weird results. Sometimes it works, but mostly does not. Seems like it depends on my character’s location.

yes, first attachment

Can you show the code for the line trace?

This works perfectly:

What I think you may be having a problem with, is the difference between the crosshair and the mouse cursor. To see the mouse cursor during gameplay, you have to type ‘SHIFT F1’.