function Promise.Wait(C)if C._fulfilled then return unpack(C._fulfilled,1,C._valuesLength)elseif C._rejected then return error(tostring(C._rejected[1]),2)else local v=Instance.new("\066\105\110\100\097\098\108\101\069\118\101\110\116")C:Then(function()v:Fire()end,function()v:Fire()end)v.Event:Wait()v:Destroy()if C._rejected then return error(tostring(C._rejected[1]),2)else return unpack(C._fulfilled,1,C._valuesLength)end end end
--[=[
	Yields until the promise is complete, and errors if an error
	exists, otherwise returns the fulfilled results.

	@yields
	@return T
]=]
function Promise:Wait()
	if self._fulfilled then
		return unpack(self._fulfilled, 1, self._valuesLength)
	elseif self._rejected then
		return error(tostring(self._rejected[1]), 2)
	else
		local bindable = Instance.new("BindableEvent")

		self:Then(function()
			bindable:Fire()
		end, function()
			bindable:Fire()
		end)

		bindable.Event:Wait()
		bindable:Destroy()

		if self._rejected then
			return error(tostring(self._rejected[1]), 2)
		else
			return unpack(self._fulfilled, 1, self._valuesLength)
		end
	end
end
