Tool Script works while the tool is not enabled?

Hello everyone,

I have stumbled upon an issue when making a custom tool script.

I’m using a local script to handle all the tools inside the inventory of the player by using User Input service.

However when I set the Enabled property to false it still works even though the script prints it as false

local script:

local UIS = game:GetService("UserInputService")
local ToolsEvent = game:GetService("ReplicatedStorage").Remotevents:WaitForChild("ToolsEvent")

UIS.InputBegan:Connect(function(Input)
	if Input.UserInputType == Enum.UserInputType.MouseButton1 or Input.UserInputType == Enum.UserInputType.Touch or Input.UserInputType == Enum.UserInputType.Gamepad1 then
		local Character = game.Players.LocalPlayer.Character
		local Tool = Character:FindFirstChildWhichIsA("Tool") 
		if Tool and Tool.Enabled == true then
			Tool.Activated:Connect(function()
				local Mouse = game.Players.LocalPlayer:GetMouse()
				ToolsEvent:FireServer(Tool.Name,Tool:GetAttribute("Type"),Mouse.Target,Mouse.Hit.Position)
				task.wait(Tool:GetAttribute("Cooldown"))
			end)

			
		end
	end
end)

server script:

Event.OnServerEvent:Connect(function(player,toolName,Type,MousePartHit,MouseHitPosition)
	local Tool = player.Character:FindFirstChild(toolName)
	print(Tool)
	print(Tool.Enabled)
	print(player)
	if Tool and Tool.Enabled == true then
		Tool.Enabled = false
		Functions[Type](player,Tool,Type,MousePartHit,MouseHitPosition)
	end	
end)

when the player press the mouse button the tool will be activated regardless of whether the tool is enabled or not. How can I fix this?

This is not a reliable way of doing this. I would create a local script for every tool instead.