# High score entry text box prints back an infinite loop

**URL:** <https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695>\
**Category:** UI\
**Tags:** text-box, unreal-engine, Widget, Blueprint, question, UMG\
**Created:** [October 15, 2018, 7:29pm UTC](https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695 "2018-10-15T19:29:12Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_dc1fa2d41](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dc1fa2d41](https://forums.unrealengine.com/u/anonymous_user_dc1fa2d41)\
**Post date:** [October 15, 2018, 7:29pm UTC](https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695/1 "2018-10-15T19:29:12Z")

</div>

Hey guys,

So I’ve added this high score entry text box to a widget my pinball game displays at the end of the game. You type in your name, it checks the save struct to see if your score is good enough to be in the top 5 high scores, and it prints out those high scores. Problem is, it seems to be printing those same 2-3 scores in an infinite loop. I’ve debugged and checked that the high score struct only has, say, two array elements if there have only been two entered names and corresponding scores, so I think I’m fairly sure it’s something to do with the UMG.

Here are some screenshots of the problem and some blueprints:

 ![256666-capture.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/0/3/e03f18e020aa83d052a0a3d91e20b4677ba0846a.jpeg)

 ![256667-capture2.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/7/a/d7a1c8436081d1f354904cb326f5e54a81630716.jpeg)

If these aren’t enough, I’ll upload a few more screenshots of the other blueprints that run after entering the name and might be the culprit.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [October 15, 2018, 9:39pm UTC](https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695/2 "2018-10-15T21:39:57Z")

</div>

Only think i can see it would looping is Output Text is not clear, like it’s not local, so try to clear it anyway. , you should use string here instead of text, text is for static text to be localizable and string is for storing text in general and can be processed, which is thing you doing.

---

<div class="post-metadata">

**Author:** ![mightyenigma](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mightyenigma](https://forums.unrealengine.com/u/mightyenigma)\
**Post date:** [October 16, 2018, 3:23am UTC](https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695/3 "2018-10-16T03:23:35Z")

</div>

I’m not sure but it might be because you’re nesting your FormatText calls.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dc1fa2d41](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dc1fa2d41](https://forums.unrealengine.com/u/anonymous_user_dc1fa2d41)\
**Post date:** [October 16, 2018, 7:43am UTC](https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695/4 "2018-10-16T07:43:57Z")

</div>

Setting it to a local variable did it, thank you! But I don’t understand what difference it made, could you maybe elaborate what logic you followed? Because I’m sure the output text isn’t being accessed anywhere other than this blueprint.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dc1fa2d41](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dc1fa2d41](https://forums.unrealengine.com/u/anonymous_user_dc1fa2d41)\
**Post date:** [October 16, 2018, 7:45am UTC](https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695/5 "2018-10-16T07:45:12Z")

</div>

No, that works fine, actually. I thought that was the problem at first as well since it’s a quick and dirty solution but it seems to work. Setting the output text to a local variable worked, however.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [October 16, 2018, 10:42am UTC](https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695/6 "2018-10-16T10:42:13Z")

</div>

Text type is primerly made for localize text in other word static display text that does not change… and your text is clearly being heavily processed. the format node you using is generally used to paste variables to localized text. Not to mention format node of text is heavier process then just using Append in String as instead of searching for tags in text it will simply paste text together. So by best practice if you want to process the text you should use String and use Format only if you want to paste something to localized or display text.

> **[FText](https://docs.unrealengine.com/5.1/en-US/ftext-in-unreal-engine/)**
>
> Reference for creating, converting, comparing, and more with FText in Unreal Engine.

> **[FString](https://docs.unrealengine.com/5.1/en-US/fstring-in-unreal-engine/)**
>
> Reference for creating, converting, comparing, and more with FStrings in Unreal Engine.

In general you should also not do this in get function as it runs on every frame that displays the widget, so you reprocess the string over and over again on every frame which you can do elsewhere just once on every change.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_dc1fa2d41](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_dc1fa2d41](https://forums.unrealengine.com/u/anonymous_user_dc1fa2d41)\
**Post date:** [October 17, 2018, 9:24am UTC](https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695/7 "2018-10-17T09:24:19Z")

</div>

Thank you for the explanation!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a5bce90f](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a5bce90f](https://forums.unrealengine.com/u/anonymous_user_a5bce90f)\
**Post date:** [February 13, 2019, 3:25pm UTC](https://forums.unrealengine.com/t/high-score-entry-text-box-prints-back-an-infinite-loop/435695/8 "2019-02-13T15:25:25Z")

</div>

THIS comment here is what helped me. I couldnt figure out why it was calling this function a BILLION times.  
“runs on every frame that displays the widget”, explains this entirely.  
Where else could I create this logic, so that it only displays it once?
