Advertisement
Joriangames

2D game camera and movement

Jan 6th, 2021
9,547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.72 KB | None | 0 0
  1. --Thanks for using this script
  2. --This script is made by Joriangames/Problox Studio Scripts
  3. --Want to know how to use this? Watch my tutorial: https://youtu.be/UzzIDpzvvE8
  4. local cam = game.Workspace.CurrentCamera
  5. local plr = game.Players.LocalPlayer
  6. wait()
  7.  
  8. local char = plr.Character
  9. local humR = char.HumanoidRootPart
  10.  
  11. cam.CameraType = Enum.CameraType.Scriptable
  12. cam.CameraSubject = char.HumanoidRootPart
  13.  
  14. local body = Instance.new("BodyPosition")
  15. body.Parent = humR
  16. body.MaxForce = Vector3.new(0, 0, math.huge)
  17. body.Position = Vector3.new(0, 0, humR.Position.Z)
  18.  
  19. game:GetService("RunService").RenderStepped:Connect(function()
  20.     cam.CFrame = CFrame.new(humR.Position.X, humR.Position.Y + 5, humR.Position.Z + 20)
  21. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement