Luduvo Contents
Theme
On this page

Profiler

reports where the last tick spent its time and how long each script took

Methods

3 members Access: shared

Dropped() -> number

scripts dropped from the profile

Frame() -> FrameStats?

timings of the last frame

Scripts() -> {ScriptCost}

per-script costs of the last frame

Reading Frame Timings and Script Costs

Lifecycle: Shared

Both readings cover the last tick only, so sample them on the frames you care about rather than once at startup.

Luau
local frame = game.Profiler.Frame()if frame then	print(string.format("Tick %.2f ms, scripts %.2f ms", frame.sim * 1000, frame.script * 1000))endfor _, cost in ipairs(game.Profiler.Scripts()) do	if cost.avg > 0.001 then		print(string.format("%s: %d calls, %.2f ms each", cost.path, cost.calls, cost.avg * 1000))	endendlocal dropped = game.Profiler.Dropped()if dropped > 0 then	warn(dropped, "scripts left out of the profile")end
Output: Tick 3.10 ms, scripts 0.85 ms