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

What is the equivalent of :IsKeyDown for a mouse button?

Im trying to do something that requires me to find out if a mouse key is being pressed

5 comments

0

Button1Down (Left) & Button2Down (Right) are both RBXScriptSignals of the Mouse Object.

0

And how do i use this info 0-0

0

What exactly are you trying to look for you didnt quite explain enough what are you trying to do?

0

Get the players mouse and make a function

0

You can find that on the Developer Wiki.

1 answer

You should make a script with a BoolValue to help!

For the Left mouse button:, see below:

local BoolValue = path.to.BoolValue -- Replace path.to.BoolValue with the path to the boolValue.
local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
Mouse.Button1Down:Connect(function()
     BoolValue.Value = true
end)
Mouse.Button1Up:Connect(function()
     BoolValue.Value = false
end)

For the Right mouse button:, see below:

local BoolValue = path.to.BoolValue -- Replace path.to.BoolValue with the path to the boolValue.
local Mouse = game:GetService("Players").LocalPlayer:GetMouse()
Mouse.Button1Down:Connect(function()
     BoolValue.Value = true
end)
Mouse.Button1Up:Connect(function()
     BoolValue.Value = false
end)

Hope this helps! Metatable out

1 comment

0

:0

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