Luduvo Contents
Theme
On this page

ScriptCost

how often one script ran and how long each call took

Fields

4 members

avg: number

average execution time per call in seconds

calls: number

number of times the script was invoked

entity: number

entity id the script is attached to

path: string

source path of the script

Finding the Scripts That Cost the Most

Lifecycle: Shared

The average covers one call in seconds, so multiplying it by the call count gives the time the script spent in total.

Luau
local budget = 0.005for _, cost in ipairs(game.Profiler.Scripts()) do	local total = cost.avg * cost.calls	if total > budget then		print(string.format("%s: %.2f ms over %d calls", cost.path, total * 1000, cost.calls))	endend