Advertisement
StoryProductions

2D Camera Script [Roblox]

Aug 27th, 2020
2,740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. local Camera = game.Workspace.Camera
  2. local Player = game.Players.LocalPlayer
  3.  
  4. repeat
  5. wait()
  6. until Player.Character
  7.  
  8. local Player = Player.Character
  9. local HumanoidRootPart = Player.HumanoidRootPart
  10.  
  11. local Positioner = Instance.new("BodyPosition", HumanoidRootPart)
  12. Positioner.MaxForce = Vector3.new(0, 0, math.huge)
  13. Positioner.Position = Vector3.new(0, 0,HumanoidRootPart.Position.Z)
  14.  
  15. Camera.CameraType = Enum.CameraType.Scriptable
  16. Camera.CameraSubject = Player.HumanoidRootPart
  17.  
  18. game:GetService("RunService").RenderStepped:connect(function()
  19. Camera.CFrame = CFrame.new(HumanoidRootPart.CFrame.X, HumanoidRootPart.CFrame.Y, HumanoidRootPart.CFrame.Z + 30)
  20. Camera.FieldOfView = 50
  21. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement