Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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 comment

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

1 answer

✓ Accepted answer

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)

1 comment

0

ty

This discussion is preserved as it was. New answers, comments, and votes are closed.