How to Override ShiftLock CameraOffset with Humanoid.CameraOffset?

I am creating a slide ability that changes the cameraoffset of my humanoid to create a more realistic feel. The only problem I have is the cameraoffset I created is being overridden by something else and does not change. The cameraoffset works within every other situation except for when I am in first person with shift lock enabled. I have tried tampering with the PlayerModule but could not find a solution.

local function SLIDE()
humanoid.CameraOffset = Vector3.new(0,-2.5,0)
end

There is a setting in StarterPlayer properties for EnableMouseLockOption,
set that to false and they can’t use shift offset.

Yeah but I still want the option of shift lock since moving around with it feels much better

If i understood your topic correctly: you are basically want to change offset of the shiftlock.

Copy the PlayerModule in StarterPlayer.StarterPlayerScripts while you are in testing mode.
image

Stop the test and paste it into the same place so we can change it and Roblox won’t override it.

So what are you looking for is in the MouseLockController module script.

image

You can go check the 108th line. Your offset value should be there. Change it as you wish.
If you want to make it accessable from every script easily (so you can change it with the other scripts easily), i can advise you to put it on shared or _G table. (like: shared.ShiftLockOffset = offsetValueObj)

2 Likes

Thank you it works very well, but I may have worded my question in a confusing way. I was wondering If I could change the cameraoffset within firstperson with shiftlocked enabled, as it seems something different than your solution is overriding it.

Yes! For sure you can.
If you want to change the offset while in FPS mode, then you should go change:

image

to this:

and it won’t check while setting the offset if it is in first person or not.

2 Likes

Thank you, that solved my problem

1 Like

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