Easy Tool Handler

Brief Description

  • Tired of having multiple scripts per tool? I created a module that lets you handle many different tools at once.

How does it work?

  • The module allows you to assign different groups to tools using TAGS. You can then use those tags to preform functions/events on those specific groups. The module also allows you to setup key binds for tools in groups and has a built-in cooldown/debounce system.
  • Add a TAG to the tool instance.

Get the module here

Documentation

Setup:

local replicated = game:GetService("ReplicatedStorage")

local handler = require(replicated["Tool Handler"]) -- Used To Update Cooldown and Create A New Group
local client = handler:NewClient() -- Used For Events

Add New Group:

local swords = handler:RegisterGroup("Swords") --Returns string

Update cooldown/debounce:

handler:UpdateCooldown(swords,0.5) -- group name, cooldown

Equipped and UnEquipped:

client.Equipped("Swords"):Connect(function(tool) --Returns tool
	print(tool.Name.. " Was Equipped")
end)
client.UnEquipped("Swords"):Connect(function(tool) --Returns tool
	print(tool.Name.. " Was UnEquipped")
end)

Auto-Fire / Hold down activated:

--[[
This function is used for automatic clicking (example; guns),
The event will fire if the player is clicking down on the screen whilst using the
groups set cooldown/debounce.
--]]
client.RepeatActivated("Pistols"):Connect(function(tool)
	print(tool.Name.. " Was Fired Using Repeat-Activated")
end)

Activated and Deactivated:

-- The Activated also uses the groups set cooldown/debounce.
client.Activated("Grenade"):Connect(function(tool)
	print(tool.. " Was Clicked")
end)
client.DeActivated("Grenade"):Connect(function(tool)
	print(tool.. " Was DeActivated")
end)

Keybinds:

--[[
Allows up to two keybinds (mainly used for PC and Console)
--]]
client.KeybindClick("Combat",Enum.KeyCode.F,Enum.KeyCode.ButtonX):Connect(function(tool)
	print(tool.. " Keybind Was Pressed")
end)
client.KeybindRelease("Combat",Enum.KeyCode.F):Connect(function(tool)
	print(tool.. " Keybind Is Released")
end)

This is my first public resource on here, feedback is appreciated

6 Likes

Hello! Can we get a video showing how this can work

Honestly, it’s a pretty bad module, first of all you could have easily putted a for loop for disconnecting a connection and to get the input events. Second of all you really could have just used collection service. Thats really it

1 Like

Thanks for the feedback
Something I’m not understanding though is the “for loop”, how would that work ?

His point isn’t valid at all. This module is useful just just not perfect. No module is.

Obviously there are better ways to iterate and gettags as well as other things but still.

I can confidently say that this is a good resource. It’s well made and useful!

2 Likes

One thing I would strongly recommend. Reworking the module if you’d like.

I recently released a bigger project called “CameraLock”. Completely obliterated all other camera modules in terms of performance and modularity. But it has gotten ZERO replies.

Keeping your module on the top of recents is a good way to get people to use and contribute.

And not even just that. This module is useful and UNIQUE.

It has a good use case especially in things like battleground games where managing tools is quite important.

Nonetheless, I would like to rework this module alongside you. Looking at the source code I can see multiple improvements I can make.

1 Like