# Potential Problem found in the documentation for Verse tutorial

**URL:** <https://forums.unrealengine.com/t/potential-problem-found-in-the-documentation-for-verse-tutorial/2301198>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, bug-report, fortnite\
**Created:** [January 24, 2025, 4:47pm UTC](https://forums.unrealengine.com/t/potential-problem-found-in-the-documentation-for-verse-tutorial/2301198 "2025-01-24T16:47:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrDJ2U](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrDJ2U](https://forums.unrealengine.com/u/MrDJ2U)\
**Post date:** [January 24, 2025, 4:47pm UTC](https://forums.unrealengine.com/t/potential-problem-found-in-the-documentation-for-verse-tutorial/2301198/1 "2025-01-24T16:47:57Z")

</div>

[[Basics of Writing Code 4 Practice Time in Verse | Unreal Editor for Fortnite Documentation | Epic Developer Community](https://dev.epicgames.com/documentation/en-us/uefn/basics-of-writing-code-4-practice-time-in-verse)]([https://Lesson](https://Lesson) 4 in verse doc)

The above has code that has a line ‘set PlayerHealth = 80.0’ without initializing it. Maybe that’s right but I don’t think so because when I copy and paste this in my vs code, it is showing that there is no variable called PlayerHealth.

I came across this trying to grant the player health with a verse device but having all sorts of issues.

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [January 24, 2025, 6:31pm UTC](https://forums.unrealengine.com/t/potential-problem-found-in-the-documentation-for-verse-tutorial/2301198/2 "2025-01-24T18:31:34Z")

</div>

The correct way to set someone’s Health is getting their instigation (agent) and then you retrieve their fort\_character like this

```auto
if(FortCharacter:=Agent.GetFortCharacter[]): # GetFortCharacter Might fail that's why I have it on an IF and put brackets on it and not just ()
       FortCharacter.SetHealth(50.0) # To Set Health
       FortCharacter.SetShield(50.0) # To Set Shield

```

Also those starting lessons are merely to teach the “logic” of the language, even if “PlayerHealth” was saved as a float on the device it wouldn’t really function or change the player’s health. Interactions with the actual players I believe is teached on the later lessons

---

<div class="post-metadata">

**Author:** ![MrDJ2U](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@MrDJ2U](https://forums.unrealengine.com/u/MrDJ2U)\
**Post date:** [March 7, 2025, 3:34pm UTC](https://forums.unrealengine.com/t/potential-problem-found-in-the-documentation-for-verse-tutorial/2301198/3 "2025-03-07T15:34:14Z")

</div>

Ok thank you! I’ve come to understand that a lot of the code there is for demonstration purposes and assumes you would write it in a function or something like that.

I fixed my code with the following function:

```auto
# Get the FortCharacter of the agent
        if (FC := Agent.GetFortCharacter[]):
            loop:
                # Get the health of the Fortnite character and make sure it is not full
                if(FC.GetHealth() < FC.GetMaxHealth()):    
                    # Store current health plus regen rate variable in a new constant
                    NewHealth := FC.GetHealth() + HealthRegenRate
                    # Set the player's health to the new health
                    FC.SetHealth(NewHealth)
                    # Wait for the cooldown period
                    Sleep(Cooldown)

```

I appreciate your response. Sorry for the delay. I’m trying to be more active on here.

PS I don’t see a way to choose your response as the ‘answer’. But I would!

---

<div class="post-metadata">

**Author:** ![Hairy\_Primate](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hairy\_Primate](https://forums.unrealengine.com/u/Hairy_Primate)\
**Post date:** [November 29, 2026, 9:53am UTC](https://forums.unrealengine.com/t/potential-problem-found-in-the-documentation-for-verse-tutorial/2301198/4 "2026-11-29T09:53:31Z")

</div>

I also ran into this “error” when working through the “Basic of Writing Code 4 Practice Time in Verse”.

So doubt there are different ways to deal with “PlayerHealth”, but the lessons did not use the fortnite health default for the examples. There is a note about this in the earlier lessons dealing with “potion” damage.

Based on the lessons, the comment by MrDJ2U is correct. That is, a variable is initialized before it is set. So, in the practice code one would expect an expression something like:

“var PlayerHealth : float = 100.0”

The variable would then have be set later by the line:

“set PlayerHealth = 80.0”
