Tool.Enabled does not prevent the Tool.Activated event from firing as the API reference says

  1. What do you want to achieve? I’m trying to prevent a tool from being activated for a brief cooldown after it has been activated by the player. A debounce variable is an an easy work around, but the Tool.Enabled property should either work as described in the API reference or the API reference should be updated to reflect the current functionality. I’m posting here because I am not currently able to post in the Bug Reports forum.

  2. What is the issue? Tool.Enabled does not prevent the Tool.Activated event from firing as the API reference describes:

It prevents the tool from being activated or deactivated by the Tool:Activate and Tool:Deactivate functions. It also prevents the Tool.Activated and Tool.Deactivated events from firing for the tool.

Using the example code block from the API reference, the player can click and the tool activates even if Tool.Enabled is set to False. Tool.Enabled also does not prevent the Tool:Activate() function from activating the tool.

I’ve attached my test project with a modified code sample from the API page which tests Tool:Activate() functionality, and the prints show Tool.Enabled is set to false before Tool:Activate() fires. There is also a tool which is set to Tool.Enabled false from the start which can still be activated by player click.

If anyone with access to post in the Bug Reports forum sees this and is able to confirm the issue, please post there so we can get a fix! Thanks.

ToolTest.rbxl (33.5 KB)

4 Likes

Setting Tool.Enabled on the client does not work. Set it on the server, which is good practice anyway because an exploiter could easily bypass this if it did work

I see the same behavior whether I set it on the client or on the server. I have a new tool with Enabled set to false and a child server script:

local tool = script.Parent

tool.Activated:Connect(function()
	print("Tool activated, tool enabled is " .. tostring(tool.Enabled))
end)

tool.Equipped:Connect(function()
	print("Manually activating tool, tool enabled is " .. tostring(tool.Enabled))
	tool:Activate()	
end)

Starting the game and equipping the tool prints:

Manually activating tool, tool enabled is false - Server - Script:8
Tool activated, tool enabled is false - Server - Script:4

Clicking activates the tool as well.

According to the API reference the Acitvate event shouldn’t fire if tool.Enabled is False but seems like it still does. Here’s a test place with the tool check on server side:
ToolTest.rbxl (33.1 KB)

1 Like

Yeah you’re right, nvm. The tool I was testing did not have a handle. I now vaguely remember having to manually check if the tool was enabled when doing stuff with .Activated …

Thanks? That’s what I just said.

Sorry for the super late reply, we’ll investigate your issue.

2 Likes

Has there been any progress made on this issue? Thanks!

It seems that Tool.Enabled = false now prevents Tool.Activated from being fired.

Didn’t even realize this was unintentional behavior until my Anti-AC scripts for my swords broke just recently.

3 Likes

same, this really tripped me up and it broke like half of my games weapons… considering the behavior has been as it was for a really long time, i feel like they probably should’ve just changed the documentation instead.
it is what it is, but the new behavior definitely felt like a breaking change rather than a fix :skull:

Thanks for the report! I’ve taken a look and updated Tool to match the documentation. The Enabled property should now properly prevent the Activated and Deactivated events.

3 Likes