Custom Camera System bug on Shift Lock

You can write your topic however you want, but you need to answer these questions:

  1. I want my Humanoid Root Part to face the direction of my camera to imitate a shift lock effect

  2. The issue is that it works fine on a Local Script, but when looked at from a server or from another player the player is glitching around and looking at different directions(Shown in the video). The effect is most present when the player is walking backwards but it also affects the player overall, this causes issues because when creating things like throwable objects the HRP is facing a different direction then the player is actually looking at, this might be a issue where the server just doesn’t know what direction the hrp is, if so then what are the solutions?

  3. All the solutions I have tried are in the code block

-- Old Code
local dir = Vector3.new(camLook.X, 0, camLook.Z).Unit
if not char:HasTag("Ragdolled") then  -- Ignore This
      hrp.CFrame = CFrame.new(hrp.Position, hrp.Position + dir)
end
-- New Code but has the same effect
local dir = fakeCam.CFrame.LookVector
if not char:HasTag("Ragdolled") then 
	hrp.CFrame = CFrame.new(hrp.Position, hrp.Position + dir)
end

local lookVector = camCF.LookVector
local flatLookVector = Vector3.new(lookVector.X, 0, lookVector.Z).Unit

pos = CFrame.new(head.Position, head.Position + flatLookVector)
pos = pos * CFrame.new(2, 0, 0)

springAnimModule.target(fakeCam, 5, 30, {CFrame = pos + bobble/2})

2 Likes

Does this happens to you(Local Player)?

1 Like
local dir = fakeCam.CFrame.LookVector
if not char:HasTag("Ragdolled") then 
    local targCFrame = CFrame.new(hrp.Position, hrp.Position + dir)
    hrp.CFrame = hrp.CFrame:Lerp(targCFrame , 0.3) 
end

Try this, this is Lerp.

3 Likes

That did work sorta, the issue stops showing up, but now the player starts tilting whenever he starts walking backwards

And to answer your question, no, it does not happen to the player running the camera

2 Likes

Tilting? can you give define i don’t know what is tilting

1 Like

You mean backward moving like sideway?

1 Like

pos = pos * CFrame.new(2, 0, 0) change this into 0,0,-2

1 Like

Yes I meant the moving sideways, whereas I want him to look straight ahead when moving backwards, that line didn’t work btw

1 Like

Also it can be mouse and body cannot compare so if body follows the Cursor it moves sideway *because screen’s center is arrow *cuz you shift lock and body’s position Left side of center so it can be cause the problem. My suggestion you can add keybind which is can’t follow the body if player goes backward. no if player not pushing Backward mouse can follow the body.

1 Like

Hope it will help you. :grinning_face: Because code dosen’t have any math mistake.

1 Like

The solution was really simple lol, the code wasent at fault all I had to do was set hum.AutoRotate to false and then re-enable it when the player is not shift locking. Thanks for the help

1 Like

funny glitches This text is a decoy

1 Like

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