-- @moduledescription Manage all the player, if they are ready or not

local module = {}
local System = require(game.ReplicatedStorage.System)

module.OnReady = System.Signal.new()

function module.Init()
	
	System.Remotes.ConnectEvent("Ready", function(plr)
		print(plr, "is ready!")
		
		local Player = System.Player.Get(plr)
		Player.Ready = true
		System.Entity.ReplicateToNewPlayer(plr)
		Player:OnDeath(true)
		
	end)
	
	game.Players.PlayerRemoving:Connect(function(p)
		local plr = System.Player.Get(p)
		if not plr then return end
		
		print(plr:ToString(), "Left")
		plr:Destroy()
	end)
end

return module
