Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I make the camera have bobbing?

Asked by 6 years ago
Edited 6 years ago

My player is locked in first person and I have this script that shows its body parts but I don't know how to make the camera go up and down with the body without affecting whether it can look down.

(This is a Local Script in StarterPlayerScripts)

local plr = game:GetService("Players").LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()

game:GetService("RunService").RenderStepped:connect(function()
    for i,v in pairs(char:GetChildren()) do
        if v:IsA("BasePart") and not string.match(v.Name, "Head") then
            v.LocalTransparencyModifier = 0
        end
    end
end)

while true do
game.Workspace.CurrentCamera.CFrame = char.Head.CFrame
wait()
end

Answer this question