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

Why does mouse lock not work in game? [UNANSWERED]

Hi! I'm using game:GetService("UserInputService").MouseBehavior = Enum.MouseBehavior.LockCenter to lock the mouse to the center of the screen. This works perfectly in Play Solo, however when I run it in game, it doesn't work.

2 comments

0

Are there any outputs when you test it?

0

None.

2 answers

I believe you need to set the camera property to LockFirstPerson. Unless you're trying to make it so that the player's mouse is locked but the camera is still outside the player?

1 comment

0

I'm also using LockFirstPerson :/

After reading the wiki here, it says the function must be called from a LocalScript. The script probably worked in Solo mode because I'm told that scripts all run locally in Solo mode. Try putting your code in a LocalScript, and if that still doesn't work, I'll look into it further.

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