Advertisement
Pluem1273

Head Follow Camera Script

Apr 9th, 2022
1,844
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.54 KB | None | 0 0
  1. local cam = workspace.CurrentCamera
  2. local player = game.Players.LocalPlayer
  3.  
  4. local character = player.Character or player.CharacterAdded:Wait()
  5. local rootpart = character:WaitForChild("HumanoidRootPart")
  6. local neck = character:FindFirstChild("Neck", true)
  7.  
  8. local y = neck.C0.Y
  9.  
  10. game:GetService("RunService").RenderStepped:Connect(function()
  11.     if neck then
  12.         local direction = rootpart.CFrame:ToObjectSpace(cam.CFrame).LookVector
  13.         neck.C0 = CFrame.new(0, y, 0) * CFrame.Angles(0, -direction.X, 0) * CFrame.Angles(direction.Y, 0, 0)
  14.     end
  15. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement