# whats wrong with my code?

**URL:** <https://forums.unrealengine.com/t/whats-wrong-with-my-code/2145184>\
**Category:** Verse\
**Tags:** unreal-engine, fortnite-creative, unreal-editor-for-fortnite, question, fortnite\
**Created:** [November 23, 2024, 2:40am UTC](https://forums.unrealengine.com/t/whats-wrong-with-my-code/2145184 "2024-11-23T02:40:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fesled](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fesled](https://forums.unrealengine.com/u/fesled)\
**Post date:** [November 23, 2024, 2:40am UTC](https://forums.unrealengine.com/t/whats-wrong-with-my-code/2145184/1 "2024-11-23T02:40:25Z")

</div>

![Screenshot 2024-11-22 195200](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/7/f879f09bc498386d8575120f54e3be25a5bcf378.png)  
 ![Screenshot 2024-11-22 195220](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/c/f/acfa99b26270d7929d6c7449f71714cd1acce23c.png)

---

<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:** [November 23, 2024, 6:34am UTC](https://forums.unrealengine.com/t/whats-wrong-with-my-code/2145184/2 "2024-11-23T06:34:15Z")

</div>

Ok so

```auto
.TurnOff()

```

requires an agent as the parameter, so it should become `.TurnOff(Agent)`

```auto
.IsRegistered(Player)

```

Is just not a function of the **player\_counter\_device** you’re probably looking for `.IsCounted(Agent)`

in **AssignWinningLoadout** function you are having as a parameter the class **DESIGNER** device which can be confused with the class **SELECTOR** device which is the one used to swap the classes of players and the function is not `.GrantClass()` but rather `.ChangeClass()`

as for OnLoadoutTimerSucess function replace the parameter from this `(Agent: agent?)` to this `(MaybeAgent : ?agent)` and then inside the function run `if(Agent:=MaybeAgent?)` this is done because the timer may or may NOT return an agent
