# Play a sound once on event tick used as a Linetrace by Channel

**URL:** <https://forums.unrealengine.com/t/play-a-sound-once-on-event-tick-used-as-a-linetrace-by-channel/401580>\
**Category:** Audio\
**Tags:** event-tick, unreal-engine, Blueprint, question\
**Created:** [August 12, 2017, 4:17pm UTC](https://forums.unrealengine.com/t/play-a-sound-once-on-event-tick-used-as-a-linetrace-by-channel/401580 "2017-08-12T16:17:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_ab1ea73f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ab1ea73f](https://forums.unrealengine.com/u/anonymous_user_ab1ea73f)\
**Post date:** [August 12, 2017, 4:17pm UTC](https://forums.unrealengine.com/t/play-a-sound-once-on-event-tick-used-as-a-linetrace-by-channel/401580/1 "2017-08-12T16:17:56Z")

</div>

Hi guys! I have the next question.

I’m using a tick event for a LineTraceByChannel emulating the mouseover event with a ray. Everytime that the ray hit on an specific object a sound should be triggered once.

When I put the node “Spawn sound attached” to play the sound it plays but in a loop. So, i thought about to use “DoOnce” node.

If I use the “DoOnce” node the sound plays once but then not anymore and I need that this sound plays everytime that the ray hit on the object.

I don’t know how to setup the “reset” property of DoOnce because if i use a Branch asking if the sound is playing it doesn’t works.

Any clue?? Thanks!!!

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [August 12, 2017, 7:33pm UTC](https://forums.unrealengine.com/t/play-a-sound-once-on-event-tick-used-as-a-linetrace-by-channel/401580/2 "2017-08-12T19:33:22Z")

</div>

You should have your `NotePlayer` as a separate actor in the world. This should have a bool indicating whether or not it is playing. Set the boolean to true when it is told to play, and set it to false after the minimum reset time.

If the bool is true when it is told to play, use a branch to not play the note.

Then when you mouse over the `NotePlayer`, call the play note function you’ll create. Then it can only be called once until the minimum reset time has elapsed.

---

<div class="post-metadata">

**Author:** ![Syalen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syalen](https://forums.unrealengine.com/u/Syalen)\
**Post date:** [August 13, 2017, 4:12am UTC](https://forums.unrealengine.com/t/play-a-sound-once-on-event-tick-used-as-a-linetrace-by-channel/401580/3 "2017-08-13T04:12:26Z")

</div>

Once your trace hits a object, store that object in a variable class.  
Before playing your sound, check if your current target is different from the previous one (the one in your variable class). This way, your sound will be played only when you’re hitting a new target.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ab1ea73f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ab1ea73f](https://forums.unrealengine.com/u/anonymous_user_ab1ea73f)\
**Post date:** [August 14, 2017, 8:49pm UTC](https://forums.unrealengine.com/t/play-a-sound-once-on-event-tick-used-as-a-linetrace-by-channel/401580/4 "2017-08-14T20:49:14Z")

</div>

Hi guys! thank you so much for the help. Finaly i solved it doing another Raytrace that evaluate the name of the object that is hit and then if the name is equal to the object name that has to play a sound, i Spawn the sound with DoOnce. If not, it reset and works good.

Now i have another problem. I need to do this with several objects so I was thinking to use an Array, but i don’t know how to do it. May you help me with that please?

Thank you!

 ![193625-hitornot.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/8/c/a8c62d029a3243f69781e0dfbbca9a4b2a4567bc.jpeg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_ab1ea73f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_ab1ea73f](https://forums.unrealengine.com/u/anonymous_user_ab1ea73f)\
**Post date:** [August 14, 2017, 9:27pm UTC](https://forums.unrealengine.com/t/play-a-sound-once-on-event-tick-used-as-a-linetrace-by-channel/401580/5 "2017-08-14T21:27:21Z")

</div>

I couldn’t make an array, so i solved it with a chain of “or” one after another.  
I close the question. Thank you again!!

---

<div class="post-metadata">

**Author:** ![BenVlodgi](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/benvlodgi/32/1194567_2.png) [@BenVlodgi](https://forums.unrealengine.com/u/BenVlodgi)\
**Post date:** [August 15, 2017, 4:44pm UTC](https://forums.unrealengine.com/t/play-a-sound-once-on-event-tick-used-as-a-linetrace-by-channel/401580/6 "2017-08-15T16:44:08Z")

</div>

You should mark the answer that solved your question upvote the ones that helped, and add your solution as an edit to your question.

---

<div class="post-metadata">

**Author:** ![PUKI\_TV](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/puki_tv/32/1123440_2.png) [@PUKI\_TV](https://forums.unrealengine.com/u/PUKI_TV)\
**Post date:** [November 13, 2025, 3:56pm UTC](https://forums.unrealengine.com/t/play-a-sound-once-on-event-tick-used-as-a-linetrace-by-channel/401580/7 "2025-11-13T15:56:58Z")

</div>

#### ![Screenshot 2025-11-13 160243](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/7/7c7b95577049285026dcc2deac440527278a7acc.png)

مرحبا انا مهدي من العراق أحببت ان أساعدك بهذا الحل المنطقي الذي اتوقع لا حل غيره انا طبقته للسيارة اذا كانت في الهواء يشتغل صوت الهواء بمجرد تهبط في الأرض يتم اطفاء الصوت بلنسبة للمتغير NextTimeSound لم اضف له اي قيمة
