Which method is more efficient?

i’d like to know which is more efficient between the 2 options

option 1:

wait(4) -- built-in function

option 2:

function CoolerWait(Time)
	local start = tick()
	local endtime
	
	repeat
		wait()
		endtime = tick() - start
	until endtime >= Time
	
	return endtime
end

CoolerWait(4)

thanks

The 2nd method you are using multiple functions so probably less efficient.

Option 1 does not allow any intermediate yielding or skipping. The other option allows more control of the yielding time. However, I would not opt in for wait() but RunService’s events using :Wait() to run it on a very high rate of loop.