Event with linetrace similar to MouseOver Event

Hi guys, I built a Blueprint that shoot a Linetrace in the center of the screen with a Tick event to evaluate if the ray is hitting over an object. When the Actor is hit appears a Highlight Material over it. If the Linetrace doesn’t hit the object, the highlight dissapears.

I need to add a sound when the linetrace hits the actor for the first time and I don’t know how to do it, because the Tick Event that I’m using now plays constantly the sound and I need that the sound plays just once.

I was thinking about make a function that evaluate the last position of the Linetrace every frame and if the new position hit the actor play the sound. After that, if the previous position has hit the actor, doesn’t play it. But I don’t know how to build it.

In short, I need the linetrace function as Mouse Over event (Begin and End).

Please Help!!

Thanks.

Hey, check the blocking hit pin at the top of the hit result. gives a True if the ray hits the target.