How to enable mouse lock from 'MouseLockController' Module?

How to enable mouse lock from ‘MouseLockController’ Module?
So this is question, how can I enable it from here?
image

I tried :Fire() and module:EnableMouseLock()

What do you want to achieve? Is this so the player is always in a shift-lock type movement?

Nope, when he equips a tool.
30chars

Is this what you mean? This is from one of my old games.

Use Player.DevEnableMouseLock instead

Editl: this only works in Server scripts

1 Like

Yes, that’s what I mean, how did you do it?

Hi. I apologize for the slow response.

Follow these instructions, but only use the command line that toggles when you detect that the character has a tool as a child

If there are any problems, let me know.

2 Likes

local Player = game.Players.LocalPlayer
local Character = Player.Character

if Player and Character and Character:FindFirstChildOfClass(“Tool”) then
self.activeCameraController:SetIsMouseLocked(true)
else
self.activeCameraController:SetIsMouseLocked(false)
end

Or something like that may work inside function CameraModule:Update(dt) to be exact.

1 Like

Yes, but sometimes it doesn’t works, like the camera get’s on the middle

Can you give more details, or show a video of what its doing, if you mean its not to the side thats default roblox behavior, which can easilly be fixed.

By changing image in the humanoid object

Or try using this to turn off shift locking normally.

Hey, thanks for the fast answer, Gun test - Roblox Look, when you equip gun this happens

Hey, it worked but it looks weird, lol, look: https://gyazo.com/bf7fd566709e5f7b3a6d896c65ec2a88

That’s the default behavior, you’re gonna have to fiddle around with it past that to get the desired effect you want, but it should be a good base for it.

1 Like