Finishing our Obby
Build a finish line that celebrates your players. Define a FinishLine trait, detect when a player finishes, send a personalized congrats with their username, and grant flight as a reward (with a one-time flag to prevent repeats).
Script
Hello mangoes and welcome back to the penultimate video! We’re almost at the finish line — let’s add a Finish Line that congratulates players and grants them flight as a reward.
Finish line logic#
We'll define a FinishLine trait for a Box Area at your goal and a simple PlayerTrait to mark whether a player has finished already. On first contact, we'll set a flag, enable flight, and send a personalized chat message.
tsimport * as J from "jamango"; export const FinishLineTrait = J.defineTrait( "FinishLine", J.schema.object({}), // no data needed { name: "Finish Line", color: "#0f0", icon: "🏁" }, ); const PlayerTrait = J.defineTrait( "PlayerTrait",
Tip: If players can fly by default in your world, disable it on join by setting canFly: false inside onPlayerJoin. Attach FinishLine to your final Box Area using the wrench, and you’re done — celebrate your finishers in style!