Here is an example of what the client OOP object could look like.
local Sword = {}
Sword.__index = Sword
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
local Engine = require(ReplicatedStorage.Engine)
local Janitor = Engine.load("Janitor")
function Sword.new()
local self = {}
self.Janitor = Janitor.new()
return setmetatable(self, Sword)
end
function Sword:Enable()
self.Janitor:GiveTask(UserInputService.InputBegan:Connect(function(input, proccessed)
if (input.UserInputType == Enum.UserInputType.MouseButton1 and not proccessed) then
print('Swing sword!')
end
end))
end
function Sword:Disable()
self.Janitor:Clean()
end
function Sword:Destroy()
self:Disable()
end
return Sword