Toggling Shift Lock Breaks Mouse

Using the below code in a localscript or studio command line then shiftlocking and unshiftlocking can break mouse and a multitude of other controls, especially with tools equipped.

local PlayerScripts = game.Players.LocalPlayer:WaitForChild("PlayerScripts")
local Controller = require(PlayerScripts:WaitForChild("PlayerModule")):GetControls():GetActiveController() 
print(Controller:GetIsJumping())

Does this with multiple tools

Video: Watch Example | Streamable

2 Likes

Hi,

I couldn’t repro this behavior immediately. Can you provide us a minimal repro file with the default PlayerScripts to demonstrate the issue?

Thanks!

1 Like

This makes the glitch happen every time but it can happen in different ways too.

  1. Turn shiftlock on in settings
  2. Run in command line during studio play
local PlayerScripts = game.Players.LocalPlayer:WaitForChild("PlayerScripts")
local Controller = require(PlayerScripts:WaitForChild("PlayerModule")):GetControls():GetActiveController() 
print(Controller:GetIsJumping())
  1. Turn shiftlock off and back on in settings then shiftlock and itll be broken.

test.rbxl (82.0 KB)

Hi,

We flipped a flag that fixed some behavior with toggling shift lock. Did that fix the issue for you?

they said it still isnt working

Thanks for letting us know. We still couldn’t seem to reproduce the behavior neither with the file, could you provide us a more thorough video demonstration starting at edit time on a baseplate?

0:00 to 0:14 : The expected behaviour is shown, this is before execution of the given script.
0:15 to 0:44 : Right when the script was executed via command bar, the camera position moved to the back of the player (unexpected behaviour). The player then pressed the Shift key to toggle shiftlock 3 times (the amount of times to shiftlock varies, it usually happens first try) and that causes the mouse to lock to the center of the screen without holding right click on the mouse (unexpected behaviour).

Please note that the unexpected behaviours are very random. Sometimes it may not move the camera position, and sometimes it will lock the mouse upon the first toggle, or after a few toggles. Sometimes, it may even take multiple executions, but regardless this behaviour should not happen at all.

The place does not matter, this same issue occurs on a newly made empty baseplate, and even with R15 characters. No default modules or scripts are edited whatsoever. There is no custom shiftlock; it is the default Roblox shiftlock.

This is the script. It calls a Get method (GetIsJumping) from a default Roblox module (PlayerModule) which should only return a bool and cause nothing else to happen:

local PlayerScripts = game.Players.LocalPlayer:WaitForChild("PlayerScripts") local Controller = require(PlayerScripts:WaitForChild("PlayerModule")):GetControls():GetActiveController() print(Controller:GetIsJumping())

Thanks for following up! Does the issue only happen when the command bar context is set to “CommandBar” instead of “GameScript”?

1 Like

From my testing, it does not have the issue if the command bar context is set to GameScript but does when its set to CommandBar

Hi,

This seems to be an issue with executing the script in a different context in the command bar, which will load a separate PlayerModule. For your use case to query the PlayerModule, you should use the GameScript context to ensure that your command is executed in the correct context. I will close this ticket, feel free to let us know if you are experiencing any additional problems!

1 Like

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