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

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

Asked by
NorteX_tv 101
5 years ago
Edited 5 years ago

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

0
Scripting Helpers is not a Request Website! Leamir 3138 — 5y
0
I'm only asking for an event, not for entire script... NorteX_tv 101 — 5y
0
(by @up I mean, that I will do the entire script myself, I only need some help!) NorteX_tv 101 — 5y
0
input service. input began and input ended TheEpicObbyCreator 32 — 5y
View all comments (3 more)
0
But will it work with while loop @up? I mean, while 1 do (infinite loop) InputBeganLine end NorteX_tv 101 — 5y
0
KminecraftPL use variables and InputService to make that Leamir 3138 — 5y
0
They are events, when player clicks down InputBegan fires you could make a loop that InputBegan enables and inputended ends TheEpicObbyCreator 32 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

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!

0
While this is correct, you should use UserInputService instead. User#19524 175 — 5y
0
UIS has mouse events? :o ThatPreston 354 — 5y
Ad

Answer this question