The first few clicks are Button1Ups and Button1Downs. When I try Button2Down, Button1Up will fire after I let go. Unless I pan the camera around, then Button2Up will properly fire. This only happens in studio with a plugin.
Try it:
textButton = Instance.new("TextButton", cameraButtonsFrame)
textButton.Size = UDim2.new(0, 200, 0, 100)
textButton.TextScaled = true
textButton.Position = UDim2.new(0, 300, 0, 200)
function button1Down()
textButton.Text = "Button 1 down"
end
textButton.MouseButton1Down:connect(button1Down)
function button2Down()
textButton.Text = "Button 2 down"
end
textButton.MouseButton2Down:connect(button2Down)
function button1Up()
textButton.Text = "Button 1 up"
end
textButton.MouseButton1Up:connect(button1Up)
function button2Up()
textButton.Text = "Button 2 up"
end
textButton.MouseButton2Up:connect(button2Up)
I think it has returned, or may not have been patched to begin with
b = game.StarterGui.ScreenGui.Frame.TextButton
local t = tick()
local function MouseButton1Down()
b.Text = "MouseButton1Down " .. tick()- t
b.TextColor3 = Color3.new(1,0,0)
end
b.MouseButton1Down:connect(MouseButton1Down)
local function MouseButton1Up()
b.Text = "MouseButton1Up " .. tick()- t
b.TextColor3 = Color3.new(0,0,1)
end
b.MouseButton1Up:connect(MouseButton1Up)
local function MouseButton2Down()
b.Text = "MouseButton2Down " .. tick()- t
b.TextColor3 = Color3.new(1,0,0)
end
b.MouseButton2Down:connect(MouseButton2Down)
local function MouseButton2Up()
b.Text = "MouseButton2Up " .. tick()- t
b.TextColor3 = Color3.new(0,0,1)
end
b.MouseButton2Up:connect(MouseButton2Up)
This is the code I ran to test this in studio.
Behaviors I noticed:
-If you MouseButton2Down and then pan the screen, MouseButton2Up will fire, as expected, upon letting go
-If you do not pan the screen(so keep the mouse completely still), it will bug out and fire MouseButton1Up instead of the expected MouseButton2Up upon letting go.
-If you have any instance selected, this bug does not happen at all regardless of panning the camera, it behaves as expected