Cursor keeps locking to center of screen

Im working on a first person game that has gui interaction in first person, but annoyingly the cursor locks to the center, making it impossible to use any of the gui elements. How can I fix this?

I had the same issue on a game that I never quite managed to resolve. It is related to UserInputService.MouseBehavior. I did try repeatedly setting it to default in a awhile loop, but it never solved the problem. My syntax may have been wrong:

if (UserInputService.KeyboardEnabled) then
	while true do
		UserInputService.MouseBehavior = Enum.MouseBehavior.Default;

I would love to know if you manage to find a fix for this.

1 Like

Im pretty ameture, so I dont know what I could do. But ill see if i can get that to work.

@BadDad2004 read this aswell all you have to do is on any text button on the screen turn modal to true which makes the mouse unlocked while in first person. To lock it back in that Ui button would have to be invisible and you only have to set the modal on one text button that’s on the screen for you to be able to move your mouse to other buttons aswell.

Add a TextButton
Set Background Transparency and Text Transparency to 1
Size to 1,0,1,0
Modal to True
Set the Button to Visible = True when a player is interacting a gui, set to Visible = false otherwise