How to detect when a player clicks while holding a tool?

Hey! I’m trying to make a game where the player has to click on a part to do something, the issue is that the clicks aren’t getting registered whenever the tool is equipped.

I’ve searched around the forums already and have found nothing that is actually useful and works.

I’m using a click detector to register these clicks, does that mess anything up?

1 Like

Is this a scripted tool? Does it rely on clicking to work. If so it’s probably in the tool script to ignore clickdetectors.
When your mouse moves over the click part does the icon change to the click icon?

Try doing a .Activated event, and get the mouse’s target when this event fires. An example of this would be:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local tool = -- wherever the tool is

tool.Activated:Connect(function()
    local target = mouse.Target

    if target then
        print(target)
    end
end)
2 Likes