Egg Spawn Interval Tester

A Roblox Studio Luau observation helper that records timestamps and summarizes minimum, maximum, mean, and median spawn intervals you provide.

Roblox Studio ModuleScript

What this script does

Record ordered timestamps from your own prototype and calculate interval statistics without assuming a universal spawn schedule.

Best for
Test a spawn system in Studio or summarize controlled observations from a project you 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

  • Records supplied timestamps or the current Studio clock
  • Calculates minimum, maximum, mean, and median
  • Rejects out-of-order samples
  • Clears all observations for a new test run

Install in the stated runtime

  1. 1
    Create a ModuleScript named SpawnIntervals.
  2. 2
    Paste the source and require it from your own spawn-system test Script.
  3. 3
    Call record whenever your own system emits a spawn event, then inspect summary after several samples.

Minimal usage example

local SpawnIntervals = require(script.Parent.SpawnIntervals)
local observations = SpawnIntervals.new()

observations:record(0)
observations:record(42)
observations:record(87)

local summary = observations:summary()
print(summary.mean, summary.median)

Example inputs and result

Supply
Successive observed timestamps in one consistent unit.
Expect
summary returns interval statistics such as mean and median; it does not predict a live server.

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.
-- Records timestamps you provide; it does not inspect another experience.

export type IntervalSummary = {
	count: number,
	minimum: number?,
	maximum: number?,
	mean: number?,
	median: number?,
}

export type SpawnIntervalTester = {
	timestamps: { number },
	record: (self: SpawnIntervalTester, timestampSeconds: number?) -> (),
	clear: (self: SpawnIntervalTester) -> (),
	intervals: (self: SpawnIntervalTester) -> { number },
	summary: (self: SpawnIntervalTester) -> IntervalSummary,
}

local SpawnIntervals = {}
SpawnIntervals.__index = SpawnIntervals

function SpawnIntervals.new(): SpawnIntervalTester
	return setmetatable({ timestamps = {} :: { number } }, SpawnIntervals) :: any
end

function SpawnIntervals.record(self: SpawnIntervalTester, timestampSeconds: number?)
	local timestamp = timestampSeconds or os.clock()
	assert(timestamp >= 0, "Timestamp must be zero or greater")
	local last = self.timestamps[#self.timestamps]
	assert(not last or timestamp >= last, "Timestamps must be recorded in order")
	table.insert(self.timestamps, timestamp)
end

function SpawnIntervals.clear(self: SpawnIntervalTester)
	table.clear(self.timestamps)
end

function SpawnIntervals.intervals(self: SpawnIntervalTester): { number }
	local intervals: { number } = {}
	for index = 2, #self.timestamps do
		table.insert(intervals, self.timestamps[index] - self.timestamps[index - 1])
	end
	return intervals
end

function SpawnIntervals.summary(self: SpawnIntervalTester): IntervalSummary
	local intervals = self:intervals()
	if #intervals == 0 then
		return { count = 0, minimum = nil, maximum = nil, mean = nil, median = nil }
	end

	table.sort(intervals)
	local total = 0
	for _, interval in intervals do
		total += interval
	end
	local middle = math.floor(#intervals / 2) + 1
	local median = if #intervals % 2 == 1
		then intervals[middle]
		else (intervals[middle - 1] + intervals[middle]) / 2

	return {
		count = #intervals,
		minimum = intervals[1],
		maximum = intervals[#intervals],
		mean = total / #intervals,
		median = median,
	}
end

return SpawnIntervals
SHA-25656e43f1568fa800ceecc9529b8e41b2ffb2ca6b46c5e54eec78ea7f25e75f9f9

Outside this script’s scope

  • Watch a live Steal An Egg server
  • Discover hidden spawn logic
  • Read network traffic or private game state

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.