Problems With The GoodSignal Module and my OOP module

I’m trying to make a Dialogue Choice system, just a method for creating a choice, and another methods for starting, triggering or ending a Choice. and I’m Using the GoodSignal Module from @stravant, for the Event Driven implementation.

here is the main module:

local Dialoge_System = {}
Dialoge_System.__index = Dialoge_System

local Signal_Class = require(game:GetService("ServerStorage").Signal)
local Choices = require(script.Choice)

function Dialoge_System.new(name)
	local self = setmetatable({},Dialoge_System)
	self.Choices = {}
	self.Name = name
	self.On_Choice_Started = Signal_Class.new()
	self.On_Choice_Selected = Signal_Class.new()
	self.On_Choice_Ended = Signal_Class.new()
	
	
	return self
end

function Dialoge_System:CreateChoice(name)
	self.Choices[name] = name
end
 
function Dialoge_System:Start_Choice (name)
	if self.Choices[name] then
		self.On_Choice_Started:Fire(name)
	end
end

function Dialoge_System:Trigger_Choice (name)
	if self.Choices[name] then
		self.On_Choice_Selected:Fire(name)
	end
	
end

function Dialoge_System:End_Choice (name)
	if self.Choices[name] then
		self.On_Choice_Ended:Fire(name)
	end
end

function Dialoge_System:DestroyChoice(name)
	if self.Choices[name] then
		self.Choices[name]:Destroy()
	end
end

function Dialoge_System:Destroy()
	setmetatable(self, nil)
	table.clear(self)
end

return Dialoge_System

and here is the server script that i’m testing The module in:

local T = require(game.ServerStorage.DSYST)
local Dialogue1 = T.new()
Dialogue1:CreateChoice("Choice_1")

Dialogue1:Start_Choice("Choice_1")

Dialogue1.On_Choice_Started:Connect(function(name)
	warn(name,"Started")
end)

for some reason, the warn statment inside the On_Choice_Started Event NEVER SHOWED.

i tried re writing the entire module and it still didn’t Work
i tried adding print statments to debug the entire thing (spoiler alert: the prints were working but nothing from the server script showed).
i tried testing the signal class itself in other implementations and on various other projects of mine
and it seemed that this is the only time this happened.

I can’t scrub my head about this problem, and I lost almost all hope on finding a solution to this.

so any help would be appreciated :pray:

–does this print?


yea i tried it before and sometimes removed the entire if statments in the methods

1 Like

I think that happened because you fired the connection before connecting it, you will have to connect it first

local T = require(game.ServerStorage.DSYST)
local Dialogue1 = T.new()
Dialogue1:CreateChoice("Choice_1")



Dialogue1.On_Choice_Started:Connect(function(name)
	warn(name,"Started")
end)

Dialogue1:Start_Choice("Choice_1")

still nothing is working
i also tried it before