PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

Button2Up

Fired when the right mouse button is released.

mouse.Button2Up:Connect(function()
print("button 2 up!")
end

For information on how to obtain the Mouse object, please see the Mouse page.

Developers can find out the position of the mouse in world-space, and if it is pointing at any BasePart using the Mouse/Hit and Mouse/Target properties.

Note, developers are recommended to use UserInputService instead of the Mouse object in new work.


Code Samples


Color Randomizer Tool (Button2Up)

The follow example changes the BasePart/BrickColor of every BasePart the player clicks and releases their right mouse button on.

In order for a part to change color, the player’s mouse must be over the part both when the player presses their right mouse button down and when the player releases their right mouse button.