Advertisement
vlustrousv

Camera Lean [R6/R15] [Local Script]

Mar 26th, 2023 (edited)
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.36 KB | Source Code | 0 0
  1. -- makes sure to keep this in startercharacterscripts
  2. -- credits to noobieYT
  3.  
  4. local character = script.Parent
  5. local humanoid = character:WaitForChild("Humanoid")
  6.  
  7. local camera = workspace.CurrentCamera
  8.  
  9. local UserInputService = game:GetService("UserInputService")
  10. local TweenService = game:GetService("TweenService")
  11. local TweenInformation = TweenInfo.new(
  12.     .25,
  13.     Enum.EasingStyle.Sine,
  14.     Enum.EasingDirection.InOut
  15. )
  16.  
  17. local Right = Vector3.new(5, 0, 0)
  18. local Left = Vector3.new(-5, 0, 0)
  19. local Middle = Vector3.new(0, 0, 0)
  20.  
  21. local Zoompov = 50
  22. local normalpov = 70
  23.  
  24. UserInputService.InputBegan:Connect(function(Key, GPS)
  25.     if Key.KeyCode == Enum.KeyCode.E and not GPS then
  26.         TweenService:Create(humanoid, TweenInformation, {CameraOffset = Right}):Play()
  27.         TweenService:Create(camera, TweenInformation, {FieldOfView = Zoompov}):Play()
  28.     elseif Key.KeyCode == Enum.KeyCode.Q and not GPS then
  29.         TweenService:Create(humanoid, TweenInformation, {CameraOffset = Left}):Play()
  30.         TweenService:Create(camera, TweenInformation, {FieldOfView = Zoompov}):Play()
  31.     end
  32. end)
  33.  
  34. UserInputService.InputEnded:Connect(function(key)
  35.     if key.KeyCode == Enum.KeyCode.E or key.KeyCode == Enum.KeyCode.Q  then
  36.         TweenService:Create(humanoid, TweenInformation, {CameraOffset = Middle}):Play()
  37.         TweenService:Create(camera, TweenInformation, {FieldOfView = normalpov}):Play()
  38.     end
  39. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement