How can I disable tool equipment?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Disabling tool equipping

  2. What is the issue? Include screenshots / videos if possible! The enable property of the tool isn’t functioning,

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Searched far and wide but haven’t found any relevant information on the topic

Even if it is currently impossible to stop the player from equipping a tool, I’d like to know how I can disable the activation event from firing.

1 Like

Theres a few ways i can think of achiving this

  1. Disable backpack this would prevent any tool from being equipped
  2. Move the player’s tool away from their backpack
  3. Use a custom backpack system

You can disable the activation by either making a boolean variable it checks or by disconnecting the event

You can try using Humanoid:UnequipTools() every time the player tries to equip the tool.

Example:

local allowedToEquip = false -- whatever you want it to be
local Tool = -- define it

Tool.Equipped:Connect(function()
    local humanoid = Tool.Parent.Humanoid

    if allowedToEquip == false then
       humanoid:UnequipTools()
    end
end)

There’s a problem with this sample code, whenever you equip the tool if you were to time it perfectly with left click, you’d be able to use the tool before the script could unequip the tool.

You can fix this by adding
if not allowedToEquip then return end
at the first line of the Tool.Activated function

like so (modified version of Feelings_La’s code)

local allowedToEquip = false -- whatever you want it to be
local Tool = -- define it

Tool.Equipped:Connect(function()
    local humanoid = Tool.Parent.Humanoid

    if not allowedToEquip then
       humanoid:UnequipTools()
    end
end)

Tool.Activated:Connect(function()
    if not allowedToEquip then return end
end)
3 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.