Mouse Button 1 and 2 issues

sometimes when i press mouse button 1, GPE is true and i can’t click any buttons.
it activates some kinda state and i have to press right click → left click (quickly otherwise it doesn’t work ?!?!?)
what makes it weirder is that sometimes it switches around then m2 doesnt work

i’ve tried using this in the command bar to test the GPE thing

game:GetService("UserInputService").InputBegan:Connect(function(input,gpe)   
  print(input.UserInputType,gpe) 
end)

m1 state
image

m2 state
image

EDIT:
i’ve narrowed it down to a specific area, im not so sure about it being script related anymore

EDIT:
turns out i had proximity prompts inside of the trees, and their keycode was Unknown

1 Like

try using a different method such as :GetMouse() with .Button1Down etc.

Your issue is that you ran it in the command bar.

UserInputService captures input in the viewport, meaning it will not detect input under either of the following circumstances:

  • The window is not focused
  • You do not click in the viewport

In a game, this is not a problem, since you will always be playing in the viewport.

yes but the main issue is that i can’t click on ui buttons

i still cannot click buttons / whatever ingame

Are you running it from the command bar? If so, don’t do that, that would be the issue.

Wait a second won’t that memory leak

the command bar was just for testing if GPE was true, i didnt use it for the actual buttons.

i’m pretty sure it clears after playtest

Why do you script like this?
game:GetService(“UserInputService”).InputBegan:Connect(function(input,gpe)
This all on one line is a bad habit.

Do any ScreenGui elements have Active = true and are layered over everything?
That may be the problem.

i only do this in command bar lol

all ui elements are Active and nothing is layered over them. i have also tested in billboardgui buttons and they also require the 2 click thing

proximity prompts!! turns out i had them on keycode unknown, which actually triggers from m1 and m2.

1 Like

Well, that makes sense then. I just keep seeing this in many other posts.
I’m not sure these are 100% trustworthy from a command bar test. This does seem very odd. I wish I could reproduce your error here. All I can think of is that something must be getting in the way somehow.

What a nightmare to debug something like that. I see why you were trying everything now.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.