Get script execution time

Is it possible to know how much time a script takes to run?

I tried searching on the forum but i did not find anything, maybe i did not use the right key-word but i tried for enough time.

Well, while not the best method (if there is any other), you could store the time when your script began and when it ended:

local start = tick()

-- Code

local end = tick()
local TimePassed = (end - start)

The keyword is probably benchmarking. This is usually something you would only do in Studio, and os.clock is perfect for the task if you’re doing this in Studio.

local start = os.clock()
-- your script
print(os.clock()-start)
6 Likes
local Start_Time = os.time() -- This is start time
function CheckExecutionTime()
return os.time()-Start_Time -- Returns execution time in seconds
end
print(CheckExecutionTime()) -- Prints execution time