# how to fix this problem in code

**URL:** <https://forums.unrealengine.com/t/how-to-fix-this-problem-in-code/2048914>\
**Category:** Verse\
**Tags:** unreal-engine, question\
**Created:** [October 2, 2024, 1:46am UTC](https://forums.unrealengine.com/t/how-to-fix-this-problem-in-code/2048914 "2024-10-02T01:46:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BamIsRich](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BamIsRich](https://forums.unrealengine.com/u/BamIsRich)\
**Post date:** [October 2, 2024, 1:46am UTC](https://forums.unrealengine.com/t/how-to-fix-this-problem-in-code/2048914/1 "2024-10-02T01:46:05Z")

</div>

![image_2024-10-01_214503470](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/6/f/96faf96f785e6f2e6c025ed0c0ca242b2fa141c3.png)  
can someone please help me fix this coding problem

---

<div class="post-metadata">

**Author:** ![SupportiveEntity](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SupportiveEntity](https://forums.unrealengine.com/u/SupportiveEntity)\
**Post date:** [October 2, 2024, 8:28am UTC](https://forums.unrealengine.com/t/how-to-fix-this-problem-in-code/2048914/2 "2024-10-02T08:28:52Z")

</div>

Hey there @BamIsRich! I believe the error is that you must encapsulate what you’re checking with the if statement.

```auto
if (Distance < 100.0):

```

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [October 3, 2024, 1:05pm UTC](https://forums.unrealengine.com/t/how-to-fix-this-problem-in-code/2048914/3 "2024-10-03T13:05:06Z")

</div>

tbh there are multiple wrong things in your code:

- while[true] doesn’t exist
- most of the indent is wrong
- Player.GetFortCharacter is failable hence needs to be called with square brackets
- your if condition is also wrong

You should watch some more tutorials, I feel like this is taken from ChatGPT or smth, because the error shouldn’t be the first that popped
