How to make a tool unable to be activated? (SOLVED)

How do you make a tool that cannot be activated through clicking, but can be activated using Tool:Activate()? I know it’s possible to achieve vice-versa using Tool.ManualActivation, But I want to make it so you can ONLY activate a tool through Tool:Activate().

My plan is to use a button from ContextActionService to fire the tool’s activation.

You can’t really do that. You should instead use events or something of the sort to “simulate” the activation instead. Unfortunately, Roblox doesn’t have an option for something like that so you’ll have to work around it.

You may be able to get a work-around like this:

local clickactivated = false
local mouse = Player:GetMouse()
local tool = workspace.Tool
	
	
tool.Equipped:Connect(function()
mouse.Button1Up:Connect(function()
	clickactivated = true	
end)
	
tool.Activated:Connect(function()
		wait()
		if clickactivated == true then
			clickactivated = false
			
		else
			-- your code
		end
	end)
end)
	
tool.Unequipped:Connect(function()
		clickactivated = false
end)
	


-- localscript inside tool

local contextActionService = game:GetService("ContextActionService")
local tool = script.Parent

local function ActionFunction(actionName, inputState, inputObject)
    if inputState == Enum.UserInputState.Begin then
        print("Tool has been activated")
    else
        print("Tool has been deactivated")
    end
end

tool.Equipped:Connect(function()
    contextActionService:BindAction("ActionId", ActionFunction, true, Enum.KeyCode.H, Enum.KeyCode.ButtonY)
end)

tool.Unequipped:Connect(function()
    contextActionService:UnbindAction("ActionId")
end)

Thanks for the ideas, I’ll use a remote event inside the tool to make it work on the server.