So I'm working on a third person camera script, it works by locking the player into first person, changing their camera offset and the body's local transparency. The render stepped function is to make the camera rotate around their side. For the most part, it works. However, I've noticed when jumping around, it makes the character's movement glitch really bad (the character "vibrates", the glitch is even worse when the player is holding a tool). I've even tried other camera methods, but this glitch still happens and I don't know what causes it. Here is my script:
local runService = game:GetService("RunService")
local plr = game.Players.LocalPlayer
local char = plr.Character
local camera = workspace.Camera
local mouse = plr:GetMouse()
camera.FieldOfView = 70
camera.CameraSubject = char.Humanoid
plr.CameraMode = "LockFirstPerson"
char.Humanoid.CameraOffset = Vector3.new(1.75,0.5,3)
wait(1)
for i,v in pairs(workspace:FindFirstChild(game.Players.LocalPlayer.Name):GetChildren()) do
if v.ClassName == "MeshPart" or v.ClassName == "Part" then
v.LocalTransparencyModifier = 0
end
if v.ClassName == "Accessory" then
v.Handle.LocalTransparencyModifier = 0
end
end
runService.RenderStepped:connect(function()
if camera.CFrame.LookVector.Y < 0 then
char.Humanoid.CameraOffset = Vector3.new(1.75, 0.5*(camera.CFrame.LookVector.Y * 4), 3 + camera.CFrame.LookVector.Y * 2)
else
char.Humanoid.CameraOffset = Vector3.new(1.75, 0.5 * -(camera.CFrame.LookVector.Y * 4), 3 - camera.CFrame.LookVector.Y * 2)
end
end)
