Where do I have mistake in this code

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!

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):

1 Like