First if statement works, not the second.
01 | local uis = game:GetService( "UserInputService" ) |
02 |
03 | local player = game.Players.LocalPlayer |
04 | local mouse = player:GetMouse() |
05 |
06 | uis.InputBegan:Connect( function (Start,End) |
07 | if mouse.Button 2 Down then |
08 | print ( "mouse.Button2Down worked" ) |
09 | elseif mouse.Button 2 Up then |
10 | print ( "mouse.Button2Up worked" ) |
11 | end |
12 | end ) |
This is because UserInputService is not the same as Mouse, the way I would do this is like this:
01 | local player = game.Players.LocalPlayer |
02 | local mouse = player:GetMouse() |
03 |
04 |
05 | mouse.Button 2 Down:Connect( function () -- function fires when your right mouse button is clicked down |
06 | print ( "mouse.Button2Down worked" ) |
07 | end ) |
08 |
09 | mouse.Button 2 Up:Connect( function () -- function fires when your right mouse button is released |
10 | print ( "mouse.Button2Up worked" ) |
11 | end ) |