# Lesson 9 Practice Time code issue.

**URL:** <https://forums.unrealengine.com/t/lesson-9-practice-time-code-issue/1227396>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, question, fortnite\
**Created:** [July 12, 2023, 8:13pm UTC](https://forums.unrealengine.com/t/lesson-9-practice-time-code-issue/1227396 "2023-07-12T20:13:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GomezUnlimited](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GomezUnlimited](https://forums.unrealengine.com/u/GomezUnlimited)\
**Post date:** [July 12, 2023, 8:13pm UTC](https://forums.unrealengine.com/t/lesson-9-practice-time-code-issue/1227396/1 "2023-07-12T20:13:52Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/3/8b36b7f85eb72c81d4cd54c8cc954e0987c316be.png)

So I got this error of the code from the lesson 9. I´m pasting it literally and I am not understanding what is missing. It says it doesn´t have expressions yet, if I copy-paste the programs from the previous lessons everything works smooth. Do you know what I´m missing?

I don´t know how to make the code screen smaller to paste the whole thing but I am literally pasting the whole lesson 9 practice time code.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![ManualPotato](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/manualpotato/32/1144902_2.png) [@ManualPotato](https://forums.unrealengine.com/u/ManualPotato)\
**Post date:** [July 13, 2023, 12:38am UTC](https://forums.unrealengine.com/t/lesson-9-practice-time-code-issue/1227396/2 "2023-07-13T00:38:13Z")

</div>

It looks like there is an issue in the example with the indentation. Here’s the snippet with type errors fixed:

```auto
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /UnrealEngine.com/Temporary/SpatialMath }

hello_world_device := class(creative_device):

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=

        Playspace:fort_playspace = GetPlayspace()
        AllPlayers:[]player = Playspace.GetPlayers()
        
        var FirstPosition:transform = transform{}
        var SecondPosition:transform = transform{}
        
        if:
            Player:player = AllPlayers[0]
            FortniteCharacter:fort_character = Player.GetFortCharacter[]
            set FirstPosition = FortniteCharacter.GetTransform()
        then:
            Print("Move or prepare to take damage!")
            Sleep(10.0)
        
        if:
            Player : player = AllPlayers[0]
            FortniteCharacter : fort_character = Player.GetFortCharacter[]
            set SecondPosition = FortniteCharacter.GetTransform()
            DistanceBetweenPositions: float = DistanceXY(FirstPosition.Translation, SecondPosition.Translation)
            DistanceBetweenPositions < 10000.0
        then:
            Print("Distance Moved: {DistanceBetweenPositions}")
            Print("Applying Damage")
            HurtPlayer(50.0)

    # Functions From Previous Lessons
    #################################

    HurtPlayer(DamageAmount : float):void=
        Playspace: fort_playspace = GetPlayspace()
        AllPlayers: []player = Playspace.GetPlayers()
        if (Player : player = AllPlayers[0]):
            if (FortniteCharacter : fort_character = Player.GetFortCharacter[]):
                MyCharacterHealth : float = FortniteCharacter.GetHealth()
                DamageToDo : float = CalculateDamage(MyCharacterHealth, DamageAmount, 1.0)
                Print("Damage To Do: {DamageToDo}")
                FortniteCharacter.Damage(DamageToDo)

    CalculateDamage(PlayerHealth:float, DesiredDamageAmount:float, MinHealth:float):float = 
        # If the damage amount would not eliminate the player, do that amount of damage
        if (PlayerHealth > DesiredDamageAmount):
            return DesiredDamageAmount
        else if (PlayerHealth > MinHealth):
            # Give player one more chance if their health is low
            return PlayerHealth - MinHealth
        else:
            # Eliminate player
            return PlayerHealth

```

---

<div class="post-metadata">

**Author:** ![capen\_r](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/capen_r/32/1145494_2.png) [@capen\_r](https://forums.unrealengine.com/u/capen_r)\
**Post date:** [July 18, 2023, 6:43pm UTC](https://forums.unrealengine.com/t/lesson-9-practice-time-code-issue/1227396/4 "2023-07-18T18:43:22Z")

</div>

There was an issue with the indentation, thank you for catching that! This has now been fixed in the document.
