I’m using OOP to make tools and I have a problem. I can’t think of a good way to detect the client’s input, or a way to load and play animations.
local ToolClass = {}
ToolClass.__index = ToolClass
local function NewEvent(eventName)
local Event = Instance.new("BindableEvent")
Event.Name = eventName
return Event
end
function ToolClass.new(owner, name, animationList)
local self = setmetatable({}, ToolClass)
self.Owner = owner
self.Model = ToolModels:FindFirstChild(name):Clone()
self.Name = name
self.IsEquipped = false
self.AnimationList = animationList or require(AnimationLists:FindFirstChild(self.Model.Name))
self.Equipped = NewEvent("Equipped")
self.Unequipped = NewEvent("Unequipped")
self.Activated = NewEvent("Activated")
return self
end