Answered by
6 years ago Edited 6 years ago
Both works, I recommend UserInputService
Example for UserInputService - from this website
1 | local UserInputService = game:GetService( "UserInputService" ) |
2 | UserInputService.InputBegan:Connect( function (input, gameProcessed) |
3 | if input.UserInputType = = Enum.UserInputType.MouseButton 1 then |
4 | print ( "The left mouse button has been pressed down at" ,input.Position) |
(Needs to be a LocalScript)
Example for player:GetMouse() - from this website
1 | local Player = game.Players.LocalPlayer |
2 | local Mouse = Player:GetMouse() |
3 | Mouse.Button 1 Down:Connect( function () |
4 | print ( "Button 1 is down" ) |
(Needs to be a LocalScript too)
As you can see, with UIS you can even get the position where player clicked, and I don't think you can do that with GetMouse().
Hope this helps!