# Where do I have mistake in this code

**URL:** <https://forums.unrealengine.com/t/where-do-i-have-mistake-in-this-code/2106320>\
**Category:** Verse\
**Tags:** unreal-engine, unreal-editor-for-fortnite, fortnite-creative, editor, question, fortnite\
**Created:** [November 5, 2024, 5:03pm UTC](https://forums.unrealengine.com/t/where-do-i-have-mistake-in-this-code/2106320 "2024-11-05T17:03:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![viperr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@viperr](https://forums.unrealengine.com/u/viperr)\
**Post date:** [November 5, 2024, 5:03pm UTC](https://forums.unrealengine.com/t/where-do-i-have-mistake-in-this-code/2106320/1 "2024-11-05T17:03:30Z")

</div>

using {FortniteUI, FortniteWorld, FortniteEntities, FortniteEvents, FortniteHealth} from FortVerse

hello\_world\_device := class(creative\_device):

class Button : fort\_entity {  
var isHit : false

```
function OnHit() : void {
    if (!isHit) {
        isHit := true
        
        ReducePlayerHealth()
    }
}
event OnBulletHit() : void {
    OnHit()
}

```

}  
function ReducePlayerHealth() : void {  
for (var player : GetPlayers()) {  
player.SetMaxHealth(180)  
player.SetHealth(180)  
}  
}  
function GetPlayers() : array\<fort\_character\> {  
return GetWorld().GetEntitiesByClass(fort\_character)  
}

function Main() : void {  
var button := Button{}  
button.SetTransform(location := Vector(1000, 500, 100))  
button.EnableCollision()  
}

Thanks for answering!

---

<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 5, 2024, 5:30pm UTC](https://forums.unrealengine.com/t/where-do-i-have-mistake-in-this-code/2106320/2 "2024-11-05T17:30:30Z")

</div>

Hello, sorry to be the bearer of bad news but like 99% of this code is wrongly written, AI code generators are not recommended for verse because they do not understand the syntax and how it works, the only thing it got right was `hello_world_device := class(creative_device):`
