Im translating my tools into OOP and I use context service to bind abilities. How would I use contextactionservice and functions and all that to handle the abilities?
local tool = {}
tool.__index = tool
local ContextActionService = game:GetService("ContextActionService")
function tool:Equip()
ContextActionService:BindAction("Light",Punch, true, Enum.UserInputType.MouseButton1)
ContextActionService:BindAction("Heavy",Punch, true, Enum.UserInputType.MouseButton2)
ContextActionService:BindAction("QuickStep",QuickStep,true,Enum.KeyCode.Q)
ContextActionService:BindAction("Block",Block,true,Enum.KeyCode.F)
end
function tool:Unequip()
ContextActionService:UnbindAction("Block")
ContextActionService:UnbindAction("Light")
ContextActionService:UnbindAction("Heavy")
ContextActionService:UnbindAction("QuickStep")
end
function tool.new(toolObject,Remotes)
local self = {}
self.ToolObject = toolObject
self.Remotes = Remotes
setmetatable(self, tool)
return self
end
return tool