Im trying to do something that requires me to find out if a mouse key is being pressed
COMMUNITY QUESTION
What is the equivalent of :IsKeyDown for a mouse button?
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.

5 comments
Button1Down (Left) & Button2Down (Right) are both RBXScriptSignals of the Mouse Object.
And how do i use this info 0-0
What exactly are you trying to look for you didnt quite explain enough what are you trying to do?
Get the players mouse and make a function
You can find that on the Developer Wiki.