I have a camera script that sets my humanoidrootpart's cframe to match the camera cframe (minus the up/down portion of course) and for some reason whenever I modify my character (add something, remove something) I will continuously move sideways dependant on my cam direction.
GIF: https://gyazo.com/e26bd98df9bdab0d97dafd55f6ad8b04
Code:
local Sensitivity = 0.8
local SHIFT = math.rad(270)
RS.RenderStepped:Connect(function()
local startCFrame = CFrame.new((char.HumanoidRootPart.CFrame.p + Vector3.new(0,2,0)))*CFrame.Angles(0, math.rad(xAngle)*Sensitivity, 0)*CFrame.Angles(math.rad(yAngle)*Sensitivity, 0, 0)
local cameraCFrame = startCFrame + startCFrame:vectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,cameraPos.Z))
local cameraFocus = startCFrame + startCFrame:vectorToWorldSpace(Vector3.new(cameraPos.X,cameraPos.Y,-50000))
cam.CFrame = CFrame.new(cameraCFrame.p,cameraFocus.p)
local lookVec = cam.CFrame.lookVector
local angle = -math.atan2(lookVec.Z, lookVec.X) + SHIFT
hrp.CFrame = CFrame.new(hrp.Position) * CFrame.Angles(0, angle, 0)
end)
