#How would i detect if the player is holding down right click?

51 messages · Page 1 of 1 (latest)

weak badge
#

Kind of like how you would detect if a key is down with UserInputService:IsKeyDown but i want it to work with the mouses right click

#

this is what i tried:

while task.wait() do
    if Mouse.Button2Down then
        GetObjectFromMouse()
    end
end
#

and yes GetObjectFromMouse is a working function and yes the mouse is refrenced properly

lapis helm
#

Button2Down is an event

#

so you can listen to that and up and make your own bool

#

or you use an alternative

long comet
#
local down = false
Mouse.Button2Down:Connect(function()
  down = true
end)

mouse.Button2Up:Connect(function()
  down = false
end)
weak badge
# lapis helm Button2Down is an event

Yeah i knew it probs wouldnt work but i just wanted to give it a shot, since they removed it from userinputservice i really didnt think of any other way

weak badge
#

Pretty sure they removed it since they have been wanting to switch it over fully to Player:GetMouse(), they talked alot about depricating it

#

And nothing appears when i type it in

#

What im saying is im sure they fully deprecated the mouse from uis

#

only can use it with player:getmouse

#

ide doubt they would remove it from cas

#

but they have been deprecating alot of shit lately

#

what

lapis helm
#

well they probably won't remove the mouse, but you should abide by current standards when making new code

weak badge
#

either im coding it wrong but i cant get the mouse from uis at all

#

tried that g

#

enum.keycode doesnt contain mouse stuff unless ide have to use enum.inputtype

lapis helm
#

for example use UIS.InputChanged

#

has mouse

weak badge
#

UserInputType.MousButton2 is not a thing

#

wait nvm

#

nah i put input type

#

didnt put userinputtype

#

doesnt matter anyways since its been solved for an hour just forgot to put the tag on

#

yeah but like homeboy said its better to use the newer stuff that isnt gonna get deprecated

lapis helm
#

yeah I use it too

#

for testing

#

but not for actual code

weak badge
#

i prefer player:getmouse since i can use the .hit and the .target

lapis helm
#

yeah it's easier

weak badge
#

it has alot of stuff you cant do with uis

#

what

#

why would the camera have anything to do with the mouse

lapis helm
#

you can do everything with the alternatives

#

you don't need mouse

#

that's why they were able to deprecate it

#

it just has certain shortcuts they alternatives don't

lapis helm
weak badge
#

o he talking about the alternitives to .hit and .target

lapis helm
#

mhm

weak badge
#

or you could use raycasts if you wanna get more advanced

#

o

#

yeah ive never used it before

lapis helm
#

well you still need to do a raycast with this

#

just returns a ray

weak badge
#

one thing about .hit or .target is the range on them is ass