local p={}p.__index=p function p.new(g)return setmetatable({_handlerListHead=false;_signalType=g},p)end function p.Connect(g,p)local F=Connection.new(g,p)if g._signalType==1 and g._handlerListHead then F._next=g._handlerListHead g._handlerListHead=F else g._handlerListHead=F end return F end

local Signal = {}
Signal.__index = Signal

function Signal.new(signal)
	return setmetatable({
		_handlerListHead = false,
		_signalType = signal
	}, Signal)
end

function Signal:Connect(fn)
	local connection = Connection.new(self, fn)

	if self._signalType == 1 and self._handlerListHead then
		connection._next = self._handlerListHead
		self._handlerListHead = connection
	else
		self._handlerListHead = connection
	end

	return connection
end
