Multiple Races per World

This package allows you to set up and configure multiple races in a single world – complete with race time saving and leaderboards for each race. It’s intended to be used in conjunction with the default raceUsesrScript provided in the Time Trial and Obstacle Course starter templates.

This package contains 2 scripts: a raceModifierScript and a raceTimeManagerScript. The raceModifierScript overwrites properties on the User’s raceUserScript to match the current race and the raceTimeManagerScript handles all the data loading/saving and leaderboard updating.


  • Install the “Multiple Races per World” package from the Community tab.
  • Add the raceTimeManagerScript to your User template.
  • On your User template click on the Race User folder, scroll down to the “onEndRace” event, and add a new event here. The Entity should be “This Template (User)”, the Script should be “raceTimeManagerScript”, and the event should be “SaveBestTime” (see screenshot below).

For each race in your world:

  • Create a trigger and add the raceModifierScript to this trigger.
  • Position this trigger in a place that players must enter it before they reach the race’s starting checkpoint. (You can place it on the starting checkpoint and make the trigger larger than the checkpoint’s trigger.)
  • Configure the properties on this trigger script. The required properties are the raceNumber, startCheckpoint, and endCheckpoint. The raceNumber property should be a number (integer) unique to the race and they should increment by 1 for each race in your world (eg: 1, 2, 3, etc…) The startCheckpoint and endCheckpoint properties are the start and finish checkpoints for this race.
  • If you have leaderboards for your races (set up on the Crayta companion site: tick the hasLeaderboard property and fill in the leaderboardName.

There are 2 additional options on the raceTimeManagerScript (attached to your User template): updateLeaderboardsOnInit and resetAllScores. If true, updateLeaderboardsOnInit will find any leaderboard referenced by raceModifierScript triggers and update it with the User’s best time for that race if it is greater than zero (ie: if they’ve raced).

The resetAllScores property will overwrite all of the saved times for any User that plays while this property is true, EVEN IN EDITOR PREVIEW. This property is useful if you want to reset your times but should always be set to false before you publish or update your game.


  • For each race, you still need to fill in the “nextCheckpoint” property for each checkpoint.
  • Properties on the raceUserScript are overwritten by the raceModifierScript so you can leave the defaults alone (as long as you configure the raceModifierScript triggers properly).

As always, if you need help or have questions about this package, please find me on the official Crayta discord (my name is ekelrock over there as well).

1 Like