There are many ways you can do this, you can use the Mouse's X and Y properties, or UserInputService
.
1 | local Player = game.Players.LocalPlayer |
2 | local Mouse = Player:GetMouse() |
01 | local UserInputService = game:GetService( "UserInputService" ) |
03 | UserInputService.InputBegan:Connect( function (Input, GPE) |
04 | if GPE then return end |
05 | print (Input.Position.X, Input.Position.Y) |
08 | UserInputService.InputChanged:Connect( function (Input, GPE) |
09 | if GPE then return end |
10 | print (Input.Position.X, Input.Position.Y) |
13 | UserInputService.InputEnded:Connect( function (Input, GPE) |
14 | if GPE then return end |
15 | print (Input.Position.X, Input.Position.Y) |