Advertisement
HowToRoblox

CameraHandler

Mar 10th, 2021
7,399
1
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 1 0
  1. local cam = workspace.CurrentCamera
  2.  
  3. local char = script.Parent
  4. local hrp = char:WaitForChild("HumanoidRootPart")
  5.  
  6.  
  7. cam.CameraType = Enum.CameraType.Scriptable
  8.  
  9.  
  10. local cameraPart = Instance.new("Part")
  11. cameraPart.Transparency = 1
  12. cameraPart.CanCollide = false
  13. cameraPart.Parent = workspace
  14.  
  15. cameraPart.CFrame = CFrame.new(hrp.Position + Vector3.new(0, 20, 0), hrp.Position)
  16.  
  17.  
  18. local bp = Instance.new("BodyPosition")
  19. bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  20. bp.Parent = cameraPart
  21.  
  22.  
  23. game:GetService("RunService").RenderStepped:Connect(function()
  24.    
  25.     bp.Position = hrp.Position + Vector3.new(0, 20, 0)
  26.    
  27.     cam.CFrame = cameraPart.CFrame
  28. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement