So basically I’m new at OOP, and I was just learning about custom signals, so I tried to make one and obviously had no hope it would be as good, but I just want to know what is bad about this module because it does work, but I’ve only added connect and fire features
Here’s the script:
local rs = game:GetService("RunService")
local running = nil
local Connection = {}
Connection.__index = Connection
function Connection.new()
local signal = {
fired = false
}
setmetatable(signal, Connection)
return signal
end
function Connection:Connect(func)
running = rs.Heartbeat:Connect(function()
if self.fired == true then
self.fired = false
task.spawn(func)
running:Disconnect()
end
end)
end
function Connection:Fire()
self.fired = true
end
return Connection