Hello, i was working on a interact system with a module. Im pretty new in OOP and i have this error
Basically all the interact system work good BUT it have functions for fire in other script and that functions don’t work
Like:
function module:OnTriggered(Player)
end
And when the function be called in the module that function should do this in other script:
function Item:OnTriggered(Player)
print(Player.Name)
end
I tried to change
local self = setmetatable({}, module)
to
local self = setmetatable(module, {})
and idk why but it works
But there is another problem, if i use local self = setmetatable(module, {})
instead of local self = setmetatable({}, module)
the module only work in one object (like if it get stuck)
Another example more detailed:
–View of module:
if self.Raycast and RayCast then
Pressing = false
CurrentlyInteracting = false
module:OnBlocked(self.Player, RayCast) --Aqui llama la function
Functions:Tween(CooldownFrame, UDim2.fromScale(1, 0))
break
end
--View of the other script
function Item2:OnBlocked(p, part)
print("Triggered")
end
The function OnBlocked() basically is nothing in the module
function module:OnBlocked(p, Part)
end