Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i detect tool holding left mouse button and leaving it?

Asked by 5 years ago

How do i detect tool holding left mouse button and leaving it?

Like

if player holding the left mouse button it print anything if leaves left mouse button prints anything again

1
This is not a script request site, you need to atleast try it yourself and if that dont work then show us what you have done and we can help you correct it Gameplayer365247v2 1055 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

This is one way of doing it. Keep in mind this is meant to be in a local script, so if you're making a gun, you need a separate server script to make the shooting function.

--- Localscript!
    UserInputService.InputBegan:Connect(function(input)
       if input.UserInputType == Enum.UserInputType.MouseButton1 then
            print("Held down")
        end
    end)    

    UserInputService.InputEnded:Connect(function(input)
    if input.UserInputType == Enum.UserInputType.MouseButton1 then
        print("Not held down")
        end
    end)
0
ty SunxLightz 30 — 5y
Ad

Answer this question