--!strict


local RunService = game:GetService("RunService")

local SteppedEvents = {}

local module = {}

function module:BindToStepped (name: string, func: () -> ())
	if SteppedEvents[name] then
		SteppedEvents[name]:Disconnect()
	end
	
	SteppedEvents[name] = RunService.Stepped:Connect(func)
end

function module:UnbindFromStepped (name: string)
	if SteppedEvents[name] then
		SteppedEvents[name]:Disconnect()
		SteppedEvents[name] = nil
	else
		warn("Nothing to unbind", name, "was already disconnected.")
	end
end

return module
