Haven’t dealt with OOP much, BUT I think you may need to return self in the .new() function, right?
(This may be completely wrong, but it’s an attempt!
(I repeat - this may be (probably will be) completely wrong)
You are also setting the local self instead of just self, which may be affecting it
Thank you for your reply. Sadly the solutions you have provided did not fix the problem but I’m really appreciate the attempts. And yeah thank you again, I forgot the return self.
Global self is only used in the enclosing function ‘new’
You need to call :Ignite() on what is returned with Lamp_Class.new(), not the module itself.
Something like this could work:
for _, v in CollectionService:GetTagged("Lamp") do
Lamp_Class.new(v):Ignite()
end
Or you store all the new lamps in a new array and then loop through that calling Ignite()
local myLamps = {}
for _, v in CollectionService:GetTagged("Lamp") do
table.insert(myLamps, Lamp_Class.new(v))
end
for _, v in myLamps do
v:Ignite()
end