Treadmill Speed Training Simulator

A pure Luau Speed progression simulator for projecting training, estimating time to a target, and comparing two gain rates in Roblox Studio.

Roblox Studio ModuleScript

What this script does

Calculate projected Speed and target time without moving a character, changing Humanoid properties, or modifying the client.

Best for
Balance a treadmill or training system in an experience you own or can edit.
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

  • Project Speed after a chosen number of minutes
  • Return nil when a target cannot be reached at zero gain
  • Compare current and candidate rates
  • No frame loop, character control, or hidden state

Install in the stated runtime

  1. 1
    Create a ModuleScript named SpeedTraining.
  2. 2
    Paste the source and require it in a Studio test Script.
  3. 3
    Use values from your own design or controlled test, then connect the math to your own UI.

Minimal usage example

local SpeedTraining = require(script.Parent.SpeedTraining)
local comparison = SpeedTraining.compareRates(2_000, 10_000, 120, 180)

print("Current minutes", comparison.currentMinutes)
print("Candidate minutes", comparison.candidateMinutes)
print("Minutes saved", comparison.minutesSaved)

Example inputs and result

Supply
Current Speed, target Speed, and two candidate gain rates from your own design.
Expect
compareRates returns the estimated time at each rate and the difference.

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. For Roblox Studio experiences you own or can edit.
-- Pure progression math with no player movement or client modification.

local SpeedTraining = {}

function SpeedTraining.project(currentSpeed: number, gainPerMinute: number, minutes: number): number
	assert(currentSpeed >= 0, "Current Speed must be zero or greater")
	assert(gainPerMinute >= 0, "Gain rate must be zero or greater")
	assert(minutes >= 0, "Minutes must be zero or greater")
	return currentSpeed + gainPerMinute * minutes
end

function SpeedTraining.minutesToTarget(
	currentSpeed: number,
	targetSpeed: number,
	gainPerMinute: number
): number?
	assert(currentSpeed >= 0 and targetSpeed >= 0, "Speed values must be zero or greater")
	if targetSpeed <= currentSpeed then
		return 0
	end
	if gainPerMinute <= 0 then
		return nil
	end
	return (targetSpeed - currentSpeed) / gainPerMinute
end

function SpeedTraining.compareRates(
	currentSpeed: number,
	targetSpeed: number,
	currentRate: number,
	candidateRate: number
): { currentMinutes: number?, candidateMinutes: number?, minutesSaved: number? }
	local currentMinutes = SpeedTraining.minutesToTarget(currentSpeed, targetSpeed, currentRate)
	local candidateMinutes = SpeedTraining.minutesToTarget(currentSpeed, targetSpeed, candidateRate)
	local minutesSaved = nil
	if currentMinutes and candidateMinutes then
		minutesSaved = currentMinutes - candidateMinutes
	end
	return {
		currentMinutes = currentMinutes,
		candidateMinutes = candidateMinutes,
		minutesSaved = minutesSaved,
	}
end

return table.freeze(SpeedTraining)
SHA-25618b506e38bf7f40c2ca114338197410f04f2f46380e47abd743f9fd9d9ab5dcf

Outside this script’s scope

  • Change WalkSpeed in Steal An Egg
  • Run a treadmill for a player
  • Bypass biome or anti-cheat requirements

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.