There is a way, 100%. I see it in my friend’s game but I don’t know how. I know this is unhelpful but I’m just assuring you it is possible.
I didnt really understand what you mean?
Also, there’s a lot of code in there, half of which I don’t understand, I don’t want to be reliant on code I don’t know.
I gave you an edited version of the PlayerModule (which is already in your game, it is simply an edited version), after you insert it you can simply set an attribute on the tool called “ForceMouseLock” and it will force shift lock when that tool is equipped, like i said, i can’t list all the changes i made and i understand you may not want to rely on that code.
Please read BaseCamera
and MouseLockController
if you wish to know what i changed, all i edited were thoses two, the rest of the code is roblox’s default code.
I don’t know what code your talking about, there’s about 50 scripts in the player Module each containing 50 to 300 lines of code, It would be easier if you could paste here on the forums the code which you added or edited.
There is 819 lines of code.
There is 211 lines of code
Could you narrow it down for me please?
I’m sure there is somehow, … Maybe ask a different question, like what is the reason you’re trying to force the shift lock. What are you looking to accomplish here. There most likely is a workaround for it.
I don’t really know any other better way to explain what I want to do, most people are familiar with shift lock so I’m using that as an example.
I want to make for example when a player holds a gun (tool), then they would be snapped into the shift lock type thing, meaning, wherever their camera looks, that’s the way the player will face.
Search
force shift lock tool
in toolbox. It gives you a folder with a tool and 3 scripts, tells you where to put them. i understand you want to know what it does, so read over the scripts
I also want the player’s mouse to be locked into the centre of the screen.
How would I do that?
Alright, like i said i made multiple changes but i will list here all the functions i edited:
MouseLockController
- MouseLockController:OnMouseLockToggled()
CameraModule
- CameraModule.new()
- CameraModule:Update()
- added CameraModule:CheckForTool()
I edited the CameraModule not BaseCamera, sorry for the small mistake
Here’s a demo, hopefully it is what you wanted to achieve.
You must set ForceMouseLock attribute to true, as that’s how it knows what tools you want and don’t want to force the lock on.
I misunderstood what you were doing.
So I’m attaching a pre-set camera to the player?
I misunderstood what you were doing.
What is attach mode?
I need 30 letters for this post
I misunderstood what you were doing.
So attach mode is shift lock?
I need 30 letters for this post
I never use shift lock but, It’s starting to look like this is what shift lock triggers.
Are you sure that this is what OP is looking for? it seems to behave very differently from shift lock, shift lock is handled by the PlayerModule more specifically MouseLockController.
@zektonn will have to clarify but it seems like he just wanted the default shift lock but simply forced when the player equips a tool, like the original post states, and attach does not behave like shift lock.