MouseLock makes the camera completely freak out if holding right click

I’m trying to make a custom shiftlock system, it all works perfectly, however the second that the player is holding right click and moving their camera whist the shiftlock is turning on, the player’s camera completely freaks out upon mouse movement, and either snaps all the way up or down, whilst spinning around rapidly.

I wish I was joking, but I commented out literally the entire system to find the bug, until a singular line of code remained, and it was:
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter

For some reason, if the player is right clicking and moving their mouse while this line of code runs, the camera just completely freaks out. The line of code is not in a loop of any kind, it runs once and doesn’t run again.

I’ve tried:
• Setting camera to scriptable before changing it
• Putting it in a loop and strictly only setting it when the player isn’t holding right click
• Searching online to the point where I think my eyes are melting

Please, any help is very greatly appreciated.
Hope you’re having a good day.

???
How are anyone supposed to know what is going on if you don’t provide any code?

Apologies but that quite literally is the entire code
Here’s a better look:

The only line is the one that I already provided, I think it might be an engine bug honestly?

That’s because it’s not an engine bug, and neither of those
If you want to implement custom shiftlock, you have to make your own player module
Because there is a specific condition check about the right mouse being held that causes it to be locked in place

Hi, please check out the bug report here Camera constantly spins while in Shiftlock mode for your issue. Thanks!

I’m sorry, are you understanding my problem?

The video shows exactly what my problem is, it’s not like the mouse isn’t locking, it’s just that the mouse is freaking out.

I showed what it’s like when enabling the shiftlock whilst moving your camera, then briefly what its like normally without it.
And before you ask - no there aren’t any other scripts in the gun - other than the animation.

Oh I see - thank you! Could you clarify if it’s just a studio bug or if it applies to actual games aswell?

This is only a Studio bug and should be rolling back right now!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.