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

R6 (First Person) Making Head Move Up and Down In The Direction You're Looking?

Asked by
OofDope -5
5 years ago
Edited 5 years ago

I'm trying to make your head go wherever you're looking up and down (R6) this is what I have:

local plr = game.Players.LocalPlayer
local char = plr.Character
local mouse = plr:GetMouse()

game:GetService('RunService').RenderStepped:connect(function()
    local dir = mouse.UnitRay.Direction.unit

    local hrot = char.HumanoidRootPart.CFrame * CFrame.new(0, 1.5, 0) * CFrame.new(char.Humanoid.CameraOffset)
    char.Torso.Neck.C0 = char.Torso.CFrame:toObjectSpace(hrot)

    if dir.y == dir.y then
        local rot = -math.asin(dir.y)
        char.Torso.Neck.C1 = CFrame.Angles(rot, 0, 0)
    end
end)

The problem is it only works in third person but I want it to work in first person (first person locked game.)

Answer this question