function AnimateLib.ConditionalOnHeartbeat(c,r,p,n)local x local A=Utils.new("\069\118\101\110\116")local d=tick()x=(game:GetService("\082\117\110\083\101\114\118\105\099\101")).Heartbeat:connect(function(p)if r()then c(p,tick()-d)else x:disconnect()A:Fire()if n then n()end end end)if p then A:wait()end end

function AnimateLib.ConditionalOnHeartbeat(callback, condition, yield, callbackOnComplete)
	local cxn;
	local event = Utils.new("Event");
	local startTime = tick();
	cxn = game:GetService("RunService").Heartbeat:connect(function(step)
		if condition() then
			callback(step, tick() - startTime)
		else
			cxn:disconnect();
			event:Fire();
			if callbackOnComplete then
				callbackOnComplete();
			end
		end
	end);
	if yield then
		event:wait();
	end
end
