I found this post showing how to Make first person camera be in head’s position and it works perfectly untell i change the cameras z axis in line 13, also if possible someone tell me how to make it a server-side script so all players can see it thx.
local cam = workspace.CurrentCamera
local plr = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
local char = plr.Character or plr.CharacterAdded:Wait()
local upperTorso = char:WaitForChild("UpperTorso")
local waist = upperTorso:WaitForChild("Waist")
local y = waist.C0.Y
RunService.RenderStepped:Connect(function()
char.Humanoid.CameraOffset = (char:WaitForChild("HumanoidRootPart").CFrame + Vector3.new(0, 1, 0)):PointToObjectSpace(char:WaitForChild("Head").Position)
if waist then
local camDirection = cam.CFrame.LookVector
local angle = math.deg(camDirection:Angle(char:WaitForChild("HumanoidRootPart").CFrame.LookVector, cam.CFrame.RightVector))
waist.C0 = waist.C0:Lerp((CFrame.new(0, y, 0) * CFrame.Angles(math.rad(math.clamp(-angle, -70, 70)),0,0)), 0.5/2)
end
end)
Developer Forum | Roblox
I recently created a script that makes the upper torso move up and down according to the camera’s direction. It works great but the problem is that the camera itself doesn’t follow the head’s position when looking up or down, this causes it to look very weird when looking high up or down. Is there a way to keep the camera’s p...