# Making Text in scrollbox dissappear after 10 seconds

**URL:** <https://forums.unrealengine.com/t/making-text-in-scrollbox-dissappear-after-10-seconds/1749057>\
**Category:** UI\
**Tags:** unreal-engine, question\
**Created:** [March 13, 2024, 7:36am UTC](https://forums.unrealengine.com/t/making-text-in-scrollbox-dissappear-after-10-seconds/1749057 "2024-03-13T07:36:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![rwita](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rwita](https://forums.unrealengine.com/u/rwita)\
**Post date:** [March 13, 2024, 7:36am UTC](https://forums.unrealengine.com/t/making-text-in-scrollbox-dissappear-after-10-seconds/1749057/1 "2024-03-13T07:36:01Z")

</div>

Hi,

I’ve made a basic chat that takes input from a message and displays it in a scrollbox. The thing is, I want all the messages in the box to be deleted after 10 seconds, I don’t actually want the user to be able to go back and read messages, and if there is no recent messages I don’t want people to have text on their screen.

What’s the best way to do this?

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 13, 2024, 7:55am UTC](https://forums.unrealengine.com/t/making-text-in-scrollbox-dissappear-after-10-seconds/1749057/2 "2024-03-13T07:55:55Z")

</div>

Run a looping 10s timer and remove scroll box child 0. Check if the scrollbox is empty first.

---

<div class="post-metadata">

**Author:** ![rwita](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rwita](https://forums.unrealengine.com/u/rwita)\
**Post date:** [March 13, 2024, 8:32am UTC](https://forums.unrealengine.com/t/making-text-in-scrollbox-dissappear-after-10-seconds/1749057/3 "2024-03-13T08:32:18Z")

</div>

Thank you, this was very helpful. One further question though if you don’t mind: Is there a way to do it to it based on when the message was created?

Example: 3 messages come in quick succession, as your code works it would be 30 seconds before the last of them is deleted, however I want their total lifetime to be 10 seconds each, so they all disappear together.

BP if needed

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/8/4/e8483a0a4d6f822874e75dd2ce84f4f5426e61e3.png)

---

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [March 13, 2024, 8:35am UTC](https://forums.unrealengine.com/t/making-text-in-scrollbox-dissappear-after-10-seconds/1749057/4 "2024-03-13T08:35:40Z")

</div>

In that case it would be easier to script the disappearing act into the message itself. Each message should be a user widget (they already are, right?) So it can:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/e/2/ce2724ab3c1d748c252bcdd13cc8af1872332cf6.png)

No other script would be necessary.

* * *

Another alternative would be to run a timer with a varying interval - the more messages there are, the more rapidly it removes them. But the earlier suggestion seems more inline with the ask.

---

<div class="post-metadata">

**Author:** ![rwita](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rwita](https://forums.unrealengine.com/u/rwita)\
**Post date:** [March 13, 2024, 8:39am UTC](https://forums.unrealengine.com/t/making-text-in-scrollbox-dissappear-after-10-seconds/1749057/5 "2024-03-13T08:39:58Z")

</div>

Ah beautiful, after how hard it was to get the text to match the player material colour I didn’t expect it to be this easy. But thank you. Works perfect.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [April 12, 2024, 8:40am UTC](https://forums.unrealengine.com/t/making-text-in-scrollbox-dissappear-after-10-seconds/1749057/6 "2024-04-12T08:40:22Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
