You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Disabling tool equipping
What is the issue? Include screenshots / videos if possible! The enable property of the tool isn’t functioning,
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.
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)