ScriptProfiler is a tool within the Developer Console that records snapshots of all running scripts at approximately one thousand times per second. You can use the profiler to debug performance issues as it can help identify scripts that are taking up the most resources in an experience.
ScriptProfiler can be used to take a snapshot of the running scripts through Developer Console. On the server side, profiling sessions are shared. The session starts when at least one user starts server-side profiling and ends when all users on the same server stop profiling. This means that if a second user starts while the profiler is already running, the second user may receive profiling data collected before they started their session.
To start a new profiling session:
Press F9 to open the Developer Console.
The default feature is Log. To change it, click the arrow and select ScriptProfiler from the dropdown menu.
Click Start to begin the profiling session. It might not look like anything is happening, but the profiler is sampling all scripts executing at this time.
Click Stop when finished to display the captured data.
The captured data is organized into various categories such as how it relates to each frame or by events.
Expand <root> and then each category in the tree to see captured information within.
Hover your cursor over a node in the call-tree to view file and line information.
The profiler supports sampling Luau functions, method calls, and property access, but it attributes the time spent in standard library calls or accessing primitive types, such as CFrame, to the calling function. Profiling data for functions that don't significantly contribute will be noisy. Threads that sleep or wait for results don't contribute to the overall time displayed by the profiler because they don't consume CPU resources.
By default, ScriptProfiler represents time spent in each node as milliseconds of CPU time. To toggle displaying the time spent as percentages of the total recording session, click Unit: %.
Switching to the Server tab enables profiling scripts running on the server. It is possible to profile both client-side and server-side simultaneously by switching between Client and Server. There may be a small delay between stopping the profiling session and updating the displayed profiling data.