I'm trying to keep my mouse centered on the screen so I can make a third person view in my game. This doesn't work but yeah :P
1 | mouse.Changed:connect( function () |
2 | mouse.Y = 0 |
3 | mouse.X = 0 |
4 | end ) |
You can use UserInputService to do this:
1 | game:GetService( "UserInputService" ).MouseBehavior = Enum.MouseBehavior.LockCenter |
There's actually a built-in way to get the players mouse, you'd need to make a local script and put it in StarterPack or StarterGui :
1 | local Player = script.Parent.Parent |
2 | local mouse = Player:GetMouse() |
3 |
4 | function CenteredMouse() |
5 | -- Code |
6 | end |
7 |
8 | -- Call the function |