Route Split Analyzer Luau Module

A dependency-free Roblox Studio Luau route analyzer that totals supplied split times, identifies the slowest leg, and compares two measured runs.

Roblox Studio ModuleScript

What this script does

Turn outbound, pickup, return, and safety split observations into a repeatable route comparison without moving a character.

Best for
Testing obstacle routes, delivery loops, time trials, and NPC paths inside a Studio project you own.
Language
Luau
Version
1.0.0
Validation
Luau runtime tested
Luau runtime tested

Official Luau 0.735 parsing and strict analysis pass, and the module is covered by the pure-module runtime behavior harness.

Included behavior

  • Total and average time
  • Slowest-leg detection
  • Baseline-versus-current comparison

Install in the stated runtime

  1. 1
    Create a ModuleScript named RouteSplits.
  2. 2
    Paste the complete source and require it from a server or test Script in your own experience.
  3. 3
    Supply split labels and non-negative seconds from your own instrumentation or manual test results.

Minimal usage example

local RouteSplits = require(script.Parent.RouteSplits)
local result = RouteSplits.analyze({
	{ label = "outbound", seconds = 12.4 },
	{ label = "return", seconds = 15.8 },
})
print(result.totalSeconds, result.slowestLabel)

Example inputs and result

Supply
Route segments with labels and elapsed seconds.
Expect
analyze returns total duration and the slowest segment label.

These notes explain the example above. Read the complete source for every exported function and edge case before integrating it.

Complete source

No hidden import, minified block, or shortened loader.

--!strict
-- MIT License. Analyzes route times supplied by your own Studio test or manual observation.

export type RouteSplit = { label: string, seconds: number }
export type RouteSummary = { totalSeconds: number, averageSeconds: number, slowestLabel: string?, slowestSeconds: number }

local RouteSplits = {}

function RouteSplits.analyze(splits: { RouteSplit }): RouteSummary
	local total = 0
	local slowestLabel: string? = nil
	local slowestSeconds = 0
	for _, split in splits do
		assert(split.label ~= "", "Split label cannot be empty")
		assert(split.seconds >= 0, "Split time must be non-negative")
		total += split.seconds
		if slowestLabel == nil or split.seconds > slowestSeconds then
			slowestLabel = split.label
			slowestSeconds = split.seconds
		end
	end
	return {
		totalSeconds = total,
		averageSeconds = if #splits == 0 then 0 else total / #splits,
		slowestLabel = slowestLabel,
		slowestSeconds = slowestSeconds,
	}
end

function RouteSplits.compare(baseline: { RouteSplit }, current: { RouteSplit })
	local before = RouteSplits.analyze(baseline).totalSeconds
	local after = RouteSplits.analyze(current).totalSeconds
	return {
		baselineSeconds = before,
		currentSeconds = after,
		differenceSeconds = after - before,
		percentChange = if before == 0 then nil else (after - before) / before,
	}
end

return table.freeze(RouteSplits)
SHA-25614ba873cf4a6eadf10a25c95dd0f758e28a53c111cfa6e997f6f97b688c22e0b

Outside this script’s scope

  • Record another experience automatically
  • Change movement, teleport a character, or choose a live route

Found a problem or a better approach?

Tell us what failed, what you expected, and whether the issue happened in the Luau CLI or Roblox Studio. Suggestions for clearer types, safer server checks, or a more useful API are welcome.

Do not submit credentials, private project files, or account data.