I want it to disable right at the moment in case the player has shift lock enabled.
So you’re telling me you disable the player’s shiftlock mid-game?
Exactly! This is to prevent players to move using the shiftlock rotation while ragdolled.
I want to force the shiftlock disabling.
Sorry! I just misclicked on the “Solution” button.
can you try this
local PlayerModule = player.PlayerScripts:WaitForChild("PlayerModule")
local mouseLock = require(PlayerModule.CameraModule.MouseLockController)
mouseLock:EnableMouseLock(true) -- Set to true or false
player.DevEnableMouseLock = false
Also, what is the last line for?
Last line is to disable MouseLock toggle, but I’ll try your solution.
wait, actually try this instead.
local PlayerModule = player.PlayerScripts:WaitForChild("PlayerModule")
local mouseLock = require(PlayerModule.CameraModule).activeMouseLockController
mouseLock:EnableMouseLock(true) -- Set to true or false
player.DevEnableMouseLock = false
Yes, got a couple errors with the last code. I’ll try this one. Thank you for keep helping me.
Got this error on the mouseLock:EnableMouseLock(false)
line
can you tell me what this prints, and also after the wait(1)
local PlayerModule = player.PlayerScripts:WaitForChild("PlayerModule")
local mouseLock = require(PlayerModule.CameraModule).activeMouseLockController
print(mouseLock)
wait(1)
print(mouseLock)
Edit: what if you just tried this
player.DevEnableMouseLock = false
Both of them are nil.
If I only use DevEnableMouseLock then if the player already had the shiftlock enabled, it won’t be disabled (DevEnableMouseLock only enables/disables the toggle function).
CameraModule:GetCameras() returns a blank table right now, there are no members (properties or functions). You will need to explicitly fork CameraModule to return the Camera singleton.
so you can just copy the PlayerModule then paste it into the StarterPlayerScripts and it works?
Correct. Roblox will not inject the default PlayerModule if you include one in StarterPlayerScripts, so the PlayerScriptsLoader that gets injected will see and require your fork instead of a PlayerModule also injected by the client at run time.
So I should just remove the “return cameraapi” line?
Alright, then @HaxxerVaxxer can just download this file and paste it into StarerPlayerScripts right?
PlayerModule.rbxm (108.5 KB)
I just saved the PlayerModule to file then pasted it here
Ok, what if you download that file, paste it into StarterPlayerScripts then tried this code
what prints?
Same (nil, nil). I already had PlayerModule in StarterPlayerScripts. What does it mean a module to be “forked”?
take the code then modify it or whatever you want to do. What i told you to do is fork the PlayerModule (copy it then paste). Then require that forked module instead of the Default module
I did what @colbert2677 said and it worked perfectly (also, I used my old script).
Anyways, thank you for really trying to help me!