# This is our main script for the race.
# It listens for events and counts laps.
using { /Fortnite.com/Devices }
using { /Verse.org/Sim }
# This is our "Scoreboard" variable.
# It holds the current lap count.
var current_lap: int = 0
# This function runs when a player hits a checkpoint.
# "player" is the person playing the game.
# "checkpoint" is the device they hit.
OnCheckpointHit(player: player, checkpoint: race_checkpoint_device) -> void:
# We add 1 to the lap count.
current_lap += 1
# Let's say the player is happy!
# We print a message to the console.
Print($"You hit checkpoint {current_lap}!")
# If they finish all laps, they win!
if current_lap >= 5:
Print("You won the race!")
# Here you could add code to show a trophy.
Verse Library
verse
01 Fragment
Tracks lap progress when players hit checkpoints and triggers victory messages upon reaching the target count.
verse-library/create-a-hoverboard-race-in-fortnite-creative/01-fragment.verse