Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How would I set a mouse to center screen?

I'm thinking it may have something to do with mouse.X and Mouse.Y but I don't know the values.

1 answer

The UserInputService has a property called MouseBehavior which sets the behavior of the mouse in 3 ways:

Enum.MouseBehavior.Default: Sets the mouse normally and the mouse moves freely

Enum.MouseBehavior.LockCenter: Centers the mouse on the screen

Enum.MouseBehaviour.LockCurrentPosition: Locks the mouse in the current position that it's at

To use this property, simply call the service and set its property to one of the 3 enums, like so:

game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter

Hope this helped!

For more info about the UserInputService, click here: UserInputService

NOTE: The UserInputService can ONLY be used from localscripts. Do not attempt to use it in a server-side script or it won't work

1 comment

0

TurboFusion be going around stealing rep. report report for hax now hes making guns for free

This discussion is preserved as it was. New answers, comments, and votes are closed.