local K={}K.Connections={}local N=setmetatable({},{__index=function(K,N)K[N]=game:GetService(N)return K[N]end})function K.WatchData(y,l,L,J)if y=="\067\114\101\097\116\101"then if N.RunService:IsClient()then local N={Key=l;Function=L}table.insert(K.Connections,N)elseif N.RunService:IsServer()then if not K.Connections[L]then K.Connections[L]={}end local N={Key=l,UserId=L;Function=J}table.insert(K.Connections[L],N)end elseif y=="\070\105\114\101"then if N.RunService:IsClient()then for K,N in ipairs(K.Connections)do(coroutine.wrap(function()if N.Key==l then N.Function(L)end end))()end elseif N.RunService:IsServer()then if K.Connections[L]then for K,N in ipairs(K.Connections[L])do(coroutine.wrap(function()if N.Key==l then N.Function(J)end end))()end end end end end return K
--// logic
local Events = {}
Events.Connections = {}

--// services
local Services = setmetatable({}, {__index = function(cache, serviceName)
    cache[serviceName] = game:GetService(serviceName)
    return cache[serviceName]
end})

--// functions
function Events.WatchData(act,dataFile,valueFile,extraFile)
	if act == 'Create' then
		if Services['RunService']:IsClient() then
			local format = {
				['Key'] = dataFile;
				['Function'] = valueFile;
			}
			table.insert(Events.Connections,format)
		elseif Services['RunService']:IsServer() then
			if not Events.Connections[valueFile] then
				Events.Connections[valueFile] = {}
			end
			local format = {
				['Key'] = dataFile;
				['UserId'] = valueFile;
				['Function'] = extraFile;
			}
			table.insert(Events.Connections[valueFile],format)
		end
	elseif act == 'Fire' then
		if Services['RunService']:IsClient() then
			for index,file in ipairs(Events.Connections) do
				coroutine.wrap(function()
					if file['Key'] == dataFile then
						file['Function'](valueFile)
					end
				end)()
			end
		elseif Services['RunService']:IsServer() then
			if Events.Connections[valueFile] then
				for index,file in ipairs(Events.Connections[valueFile]) do
					coroutine.wrap(function()
						if file['Key'] == dataFile then
							file['Function'](extraFile)
						end
					end)()
				end
			end
		end
	end
end

return Events