# Import the necessary systems using { FortniteVerseSystemsLibrary, Player, Timer, Widget } # This is our main script. It "lives" on a Player. # Think of it as the player's personal assistant. script LowHealthMonitor(Player) is { # This is a Variable. # A variable is like a loot box that can change contents. # Here, it holds the reference to our custom widget. var LowHealthUI : Widget = null # This is a Function. # A function is like a recipe or a device action. # It’s a block of code that does something when called. on Start() is { # 1. Create the Widget Instance # We tell the system to "spawn" our LowHealthWidget. # Only this player sees it. LowHealthUI = CreateWidget(LowHealthWidget) # 2. Attach the Widget to the Player # This is like handing the menu to the player at their table. Player.SetUserInterface(LowHealthUI) # 3. Start a Timer to check health # We call our CheckHealth function every 1 second. # This is like a heartbeat monitor ticking. StartTimer(1.0, CheckHealth) } # This is another Function: CheckHealth # It runs every time the timer ticks. on CheckHealth() is { # Get the player's current health. # Think of this as checking the loot pool. current_health := Player.GetHealth() # This is an If Statement. # It’s like a trap door: IF condition is true, THEN trigger. if (current_health < 50.0) { # Show the widget LowHealthUI.Show() # Optional: Change text color to red if not already # (Simplified for brevity) } else { # Hide the widget if health is safe LowHealthUI.Hide() } # Restart the timer to keep checking! # This is the loop. It keeps the game alive. StartTimer(1.0, CheckHealth) } }