I have this module:
local Remote = script.RemoteEvent
local Ping = {}
function Ping.new()
return setmetatable({
--Properties:
ID = 1,
},{
--Index Class:
__index = Ping
})
end
function Ping:Connect(fn)
return Remote.OnServerEvent:Connect(function(OtherID, ...)
print("Recieved")
if OtherID == self.ID then
print("Similiar")
task.spawn(fn(...))
end
end)
end
function Ping:Fire(...)
Remote:FireServer(self.ID, ...)
end
return Ping
Which I use in this module:
local Ping = require(script.Parent.Ping)
local PingList = {}
PingList.Printer = Ping.new()
return PingList
Which I use in this server script:
local PingList = require(game:GetService("ReplicatedStorage").PingList)
PingList.Printer:Connect(function(Printer)
print(Printer)
end)
Which I send an event a to using this local script:
local RS = game:GetService("ReplicatedStorage")
local PingList = require(RS.PingList)
print(PingList.Printer)
game:GetService("RunService").Heartbeat:Connect(function()
PingList.Printer:Fire("EEE")
end)
Before asking if self.ID == ID, I put a print there and it printed meaning some OOP wizardry happened that need help understanding…
Edit: Thanks for the help guys.