How do i make a tool that can do more than just one thing?

Heya, i’m making a game where you hold a hammer to solve puzzles and stuff, so throughout the game, you collect abilities to make your hammer more useful, so what i want to achieve here is a tool that for example, if you hold click, you throw the tool and stuff, but if you just click it it just attacks.

You would achieve this with different Input Logic

If you wanted it to hold click, one potential solution might go something like this:

local holdTick = 0

UserInputService.InputBegan:Connect(function(IO, GP)
    if not GP and IO.UserInputType == Enum.UserInputType.MouseButton1 then
        local hold = tick()
        holdTick = hold
        wait(3)
        if holdTick == hold then
            -- Throw
        end
    end
end)

UserInputService.InputEnded:Connect(function(IO, GP)
    if not GP and IO.UserInputType == Enum.UserInputType.MouseButton1 then
        if holdTick and tick()-holdTick < .5 then
             -- Attack
        end
        holdTick = 0
    end
end)