local E=game:GetService("\083\101\114\118\101\114\083\099\114\105\112\116\083\101\114\118\105\099\101")local p=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local T=require(p.Packages.RECS)local I=require(E.Components.Example)local g=T.System:extend("\069\120\097\109\112\108\101")function g.init(E)for p,T in E.core:components(I)do E:added(p,T)end E.componentAddedSignal=E.core:getComponentAddedSignal(I)E.maid.componentAddedConnection=E.componentAddedSignal:connect(function(p,T)E:added(T,p)end)E.componentRemovingSignal=E.core:getComponentRemovingSignal(I)E.maid.componentRemovingConnection=E.componentRemovingSignal:connect(function(p,T)E:removing(p,T)end)end function g.added(T,E,p)wait()end function g.removing(T,E,p)wait()end function g.step(p,E) end return g
local ServerScriptService = game:GetService("ServerScriptService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local RECS = require(ReplicatedStorage.Packages.RECS)
local ExampleComponent = require(ServerScriptService.Components.Example)

--[[
	System setup
	================
]]

local Example = RECS.System:extend("Example")

function Example:init()
	for instance, component in self.core:components(ExampleComponent) do
		self:added(instance, component)
	end

	self.componentAddedSignal = self.core:getComponentAddedSignal(ExampleComponent)
	self.maid.componentAddedConnection = self.componentAddedSignal:connect(function(component, instance)
		self:added(instance, component)
	end)

	self.componentRemovingSignal = self.core:getComponentRemovingSignal(ExampleComponent)
	self.maid.componentRemovingConnection = self.componentRemovingSignal:connect(function(instance, component)
		self:removing(instance, component)
	end)
end

function Example:added(instance, component)
	wait() -- HACK, having to wait for the inst to have the component applied

	-- Do added stuff with the component here!
end

function Example:removing(instance, component)
	wait() -- HACK, having to wait for the inst to have the component applied

	-- Do removing stuff with the component here!
end

function Example:step(dt)
	-- Do stuff on step!
end

return Example
