local A=game:GetService("\082\117\110\083\101\114\118\105\099\101")local b=require(script.Parent.Parent.lib.t)local O=.01 local function w(w)assert(b.number(w))local X=0 w=w or O while X<w do X=X+A.Heartbeat:Wait()end return X end return w
--[[
	Yields the current thread for the given amount of time.

	This is a better alternative to wait(), as the amount of time it waits is
	deterministic. This uses Heartbeat for consistent timing.

	Usage:

		yield(10)
		print("Hello")
		yield(10)
		print("World")
]]

local RunService = game:GetService("RunService")

local t = require(script.Parent.Parent.lib.t)

local DEFAULT_WAIT = 0.01 -- less than 1 frame

local function yield(waitTime)
	assert(t.number(waitTime))

	local elapsed = 0

	waitTime = waitTime or DEFAULT_WAIT

	while elapsed < waitTime do
		elapsed = elapsed + RunService.Heartbeat:Wait()
	end

	return elapsed
end

return yield
