I'm developing a game where there are tools which are equippable by scrolling the mouse wheel, however the mouse wheel is already bound to zooming in and out. Any way I could lock the player in the shift lock state? If not, maybe just point me in the right direction.
I have tried locking the Camera Min/Max Zoom Distance property but that doesn't lock the cursor in place.
I have tried looking through all the properties of the player to try and find something helpful.
I have tried some of the Enum.CameraType's on the player.
I can't seem to find anything that works.
Ok, I lurked around for a while and came up with a kinda hacky solution:
First, go to StarterPlayer folder in Explorer and disable "EnableMouseLockOption"
Then create a local script in StarterPlayerScripts and put this in:
local Player = game.Players.LocalPlayer repeat wait() until Player:HasAppearanceLoaded() local cam = require(Player.PlayerScripts.PlayerModule.CameraModule).activeCameraController local camLock = require(Player.PlayerScripts.PlayerModule.CameraModule.MouseLockController) local offset = camLock:GetMouseLockOffset() cam:SetIsMouseLocked(true) cam:SetMouseLockOffset(offset)
It should techincally lock your player in shift-lock state and mouse zooming won't break it.
Lemme know if it works
I'm not too sure how to do that exactly, I'm sure there are different methods to doing that but something that can give similar functionality to what you want could be the "Enum.MouseBehavior.LockCenter" and I think it might be worth a look.