Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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.

0
Are there any outputs when you test it? Uroxus 350 — 9y
0
None. Protoduction 216 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

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?

0
I'm also using LockFirstPerson :/ Protoduction 216 — 9y
Ad
Log in to vote
0
Answered by
yumtaste 476 Moderation Voter
9 years ago

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.

Answer this question