local N={}N.__index=N N.Service=nil function N.new()local X=N.Service or{}setmetatable(X,N)X.BindedPlayerAddedFunctions={}X.BindedCharacterAddedFunctions={}X.BindedPlayerRemovingFunctions={}for N,Y in pairs(game.Players:GetPlayers())do X:PlayerAdded(Y)end X.Connections={PlayerAdded=game.Players.PlayerAdded:Connect(function(N)X:PlayerAdded(N)end);PlayerRemoving=game.Players.PlayerRemoving:Connect(function(N)X:PlayerRemoving(N)end)}N.Service=X return X end function N.PlayerAdded(X,N)for X,Y in pairs(X.BindedPlayerAddedFunctions)do Y(N)end if N.Character then X:CharacterAdded(N.Character)end N.CharacterAdded:Connect(function(N)X:CharacterAdded(N)end)end function N.PlayerRemoving(X,N)for X,Y in pairs(X.BindedPlayerRemovingFunctions)do Y(N)end end function N.CharacterAdded(X,N)for X,Y in pairs(X.BindedCharacterAddedFunctions)do Y(N)end end function N.AddPlayerAddedFunc(Y,N,X)Y.BindedPlayerAddedFunctions[N]=X for N,Y in pairs(game.Players:GetPlayers())do warn(Y.Name.." \119\097\115 \097\108\114\101\097\100\121 \105\110 \116\104\101 \103\097\109\101 \098\101\102\111\114\101 \119\101 \097\100\100\101\100 \116\104\105\115 \112\108\097\121\101\114 \097\100\100\101\100 \102\117\110\099\116\105\111\110")X(Y)end end function N.AddPlayerRemovingFunc(Y,N,X)Y.BindedPlayerRemovingFunctions[N]=X end function N.AddCharacterAddedFunc(Y,N,X)Y.BindedCharacterAddedFunctions[N]=X for N,Y in pairs(game.Players:GetPlayers())do if Y.Character then warn(Y.Name.." \119\097\115 \097\108\114\101\097\100\121 \105\110 \116\104\101 \103\097\109\101 \098\101\102\111\114\101 \119\101 \097\100\100\101\100 \116\104\105\115 \067\104\097\114\097\099\116\101\114 \097\100\100\101\100 \102\117\110\099\116\105\111\110")X(Y.Character)end end end function N.Deconstruct(N) end return N


local this = {}
this.__index = this

this.Service = nil

function  this.new(  )
	-- body
	local self = this.Service or {}
	setmetatable(self,this)


	self.BindedPlayerAddedFunctions = {}
	self.BindedCharacterAddedFunctions = {}
	self.BindedPlayerRemovingFunctions = {}

	for _,v in pairs(game.Players:GetPlayers()) do
		self:PlayerAdded(v)
	end
	self.Connections = {
		PlayerAdded = game.Players.PlayerAdded:Connect(function(plr)
			self:PlayerAdded(plr)
		end);
		PlayerRemoving = game.Players.PlayerRemoving:Connect(function(plr)
			self:PlayerRemoving(plr)
		end);
	}

	this.Service = self
	return self
end

function this:PlayerAdded( plr )
	for _,v in pairs(self.BindedPlayerAddedFunctions) do
		v(plr)
	end
	if plr.Character then
		self:CharacterAdded(plr.Character)
	end
	plr.CharacterAdded:Connect(function( char )
		self:CharacterAdded(char)
	end)
end

function  this:PlayerRemoving( plr )
	for _,v in pairs(self.BindedPlayerRemovingFunctions) do
		v(plr)
	end
end

function this:CharacterAdded(char)
	for _,v in pairs(self.BindedCharacterAddedFunctions) do
		v(char)
	end
end

function  this:AddPlayerAddedFunc(name, func )
	-- body
	self.BindedPlayerAddedFunctions[name] = func
	for i,v in pairs(game.Players:GetPlayers()) do
		warn(v.Name.. " was already in the game before we added this player added function")
		func(v)
	end
end

function  this:AddPlayerRemovingFunc(name, func )
	-- body
	self.BindedPlayerRemovingFunctions[name] = func
end

function  this:AddCharacterAddedFunc(name, func )
	-- body
	self.BindedCharacterAddedFunctions[name] = func
	for i,v in pairs(game.Players:GetPlayers()) do
		if v.Character then
			warn(v.Name.. " was already in the game before we added this Character added function")
			func(v.Character)
		end
	end
end

function this:Deconstruct() -- Delete the player's object

end

return this
