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

What is the event for Left mouse button Hold and Release?

I need an event for when (left) mouse button is starting to press and when it releases.

If you need more than this, I want to make a mechanism of holding a button with progress bar increasing...

Sorry, IK I'm badly hurting english.

Edit: it shouldn't be InputBegan, but something in kind: if mouse.Pressed == true, because I need to use this IF in while loop

7 comments

0

Scripting Helpers is not a Request Website!

0

I'm only asking for an event, not for entire script...

0

(by @up I mean, that I will do the entire script myself, I only need some help!)

0

input service. input began and input ended

0

But will it work with while loop @up? I mean, while 1 do (infinite loop) InputBeganLine end

0

KminecraftPL use variables and InputService to make that

0

They are events, when player clicks down InputBegan fires you could make a loop that InputBegan enables and inputended ends

1 answer

✓ Accepted answer

The events you are describing are Button1Down and Button1Up. Here’s an example.

local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Mouse.Button1Down:Connect(function()

end)

Mouse.Button1Up:Connect(function()

end)

Keep in mind the mouse is client sided, so attempting to use :GetMouse() on the server will throw an error. Good luck!

2 comments

0

While this is correct, you should use UserInputService instead.

0

UIS has mouse events? :o

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