Hello everyone. Have you ever encountered a problem with mouse manipulation? Lets say you want to make automatic gun (banal question) or pickaxe which breaking ores, and to determine when player holding mouse u need quite big code.
local isMouseDown = false
UserInputService.InputBegan:Connect(function(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
isMouseDown = true
end
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessed)
if not gameProcessed then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
isMouseDown = false
end
end
end)
So thats why im here. I want to introduce you holding tool event.
local tool = script.Parent
tool.Hold:Connect(function()
print("tool holding")
end)
I think this script simplify ur script. I mean if tool have happening tool.Activated which working when player clicking on mouse one time. So why not add tool.Hold event which working when player holding left button of mouse. Any thoughts? There is could minuses of this trigger. But i didnt find, obviously i could wrong🤔