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!