Advertisement
BobMe

camera

Oct 16th, 2021
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.43 KB | None | 0 0
  1. NLS([[
  2. script.Parent = game.Players.LocalPlayer.PlayerScripts
  3. local locked = false
  4.  
  5. local cam = workspace.CurrentCamera
  6. cam.CameraType = Enum.CameraType.Scriptable
  7.  
  8. local runService = game:GetService("RunService")
  9. local userInputService = game:GetService("UserInputService")
  10. local deltaa = Vector2.new(0,0)
  11. local zoom = 10
  12. local sens = 0.0125
  13. local scale = 1
  14. local firstperson = false
  15. local zoomed = false
  16.  
  17. repeat wait() until game.Players.LocalPlayer.Character:FindFirstChild("Head") ~= nil and game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") ~= nil
  18. local subtraction = game.Players.LocalPlayer.Character.Head.Position.Y - game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y
  19.  
  20. local Search
  21. function Search(Parent, Function)
  22. for Index, Object in next, Parent:children() do
  23. pcall(function()
  24. Function(Object)
  25. end)
  26. Search(Object, Function)
  27. end
  28. end
  29.  
  30. function showchar(char)
  31. coroutine.resume(coroutine.create(function()
  32. local Character = char
  33. Search(Character, function(Object)
  34. if (Object:IsA'BasePart' or Object:IsA'Decal') and Object.Name ~='HumanoidRootPart' then
  35. Object.Transparency = 0
  36. end
  37. end)
  38. end))
  39. end
  40.  
  41. function hidechar(char)
  42. coroutine.resume(coroutine.create(function()
  43. local Character = char
  44. Search(Character, function(Object)
  45. if (Object:IsA'BasePart' or Object:IsA'Decal') and Object.Name ~='HumanoidRootPart' then
  46. Object.Transparency = 1
  47. end
  48. end)
  49. end))
  50. end
  51.  
  52. coroutine.resume(coroutine.create(function()
  53. while wait() do
  54. if game.Players.LocalPlayer.Character:FindFirstChild("Head") ~= nil and game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") ~= nil then
  55. if scale ~= game.Players.LocalPlayer.Character.Head.Size.Y then
  56. scale = game.Players.LocalPlayer.Character.Head.Size.Y
  57. subtraction = game.Players.LocalPlayer.Character.Head.Position.Y - game.Players.LocalPlayer.Character.HumanoidRootPart.Position.Y
  58. end
  59. end
  60. end
  61. end))
  62.  
  63. local function OnRenderStep()
  64. if game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") ~= nil then
  65. if zoom > 0.65 then
  66. local delta = userInputService:GetMouseDelta()
  67. cam.CFrame = CFrame.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position + Vector3.new(0,subtraction,0))
  68. delta = Vector2.new((delta.X*sens),(delta.Y*sens))
  69. deltaa = deltaa + (delta*Vector2.new(-1,-1))
  70. cam.CFrame = cam.CFrame * CFrame.Angles(0,deltaa.X,0) * CFrame.Angles(deltaa.Y,0,0) * CFrame.new(0,0,(zoom * (scale/1)))
  71. else
  72. local delta = userInputService:GetMouseDelta()
  73. cam.CFrame = CFrame.new(game.Players.LocalPlayer.Character.HumanoidRootPart.Position + Vector3.new(0,subtraction,0))
  74. delta = Vector2.new((delta.X*sens),(delta.Y*sens))
  75. deltaa = deltaa + (delta*Vector2.new(-1,-1))
  76. cam.CFrame = cam.CFrame * CFrame.Angles(0,deltaa.X,0) * CFrame.Angles(deltaa.Y,0,0)
  77. end
  78. end
  79. end
  80.  
  81. runService:BindToRenderStep("MeasureMouseMovement", Enum.RenderPriority.Input.Value, OnRenderStep)
  82.  
  83. userInputService.InputBegan:Connect(function(input, gameProcessed)
  84. if input.UserInputType == Enum.UserInputType.MouseButton2 and not gameProcessed and zoom > 0.65 then
  85. userInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
  86. elseif input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessed then
  87. if input.KeyCode == Enum.KeyCode.Z and firstperson then
  88. workspace.CurrentCamera.FieldOfView = 10
  89. sens = 0.0125/10
  90. zoomed = true
  91. end
  92. end
  93. end)
  94.  
  95. userInputService.InputEnded:Connect(function(input, gameProcessed)
  96. if input.UserInputType == Enum.UserInputType.MouseButton2 and not gameProcessed and zoom > 0.65 then
  97. userInputService.MouseBehavior = Enum.MouseBehavior.Default
  98. elseif input.UserInputType == Enum.UserInputType.Keyboard and not gameProcessed then
  99. if input.KeyCode == Enum.KeyCode.Z and zoomed then
  100. workspace.CurrentCamera.FieldOfView = 70
  101. sens = 0.0125
  102. zoomed = false
  103. end
  104. end
  105. end)
  106.  
  107. userInputService.InputChanged:Connect(function(input, gameProcessed)
  108. if input.UserInputType == Enum.UserInputType.MouseWheel then
  109. if not zoomed then
  110. if zoom + (input.Position.Z * -1 * (zoom/7)) >= 0 then
  111. if zoom > 0.65 or input.Position.Z == -1 then
  112. zoom = zoom + input.Position.Z * -1 * (zoom/7)
  113. if zoom <= 0.65 and game.Players.LocalPlayer.Character:FindFirstChild("Head").Transparency ~= 1 then
  114. hidechar(game.Players.LocalPlayer.Character)
  115. userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
  116. firstperson = true
  117. elseif game.Players.LocalPlayer.Character:FindFirstChild("Head").Transparency ~= 0 then
  118. showchar(game.Players.LocalPlayer.Character)
  119. userInputService.MouseBehavior = Enum.MouseBehavior.Default
  120. firstperson = false
  121. end
  122. end
  123. end
  124. else
  125. workspace.CurrentCamera.FieldOfView = workspace.CurrentCamera.FieldOfView + ((input.Position.Z*-1)/2)
  126. sens = (workspace.CurrentCamera.FieldOfView/10) * (0.0125/10)
  127. end
  128. end
  129. end)
  130.  
  131. wait(1.1)
  132. local plr = game.Players.LocalPlayer
  133. local body = plr.Character.Humanoid.BodyHeightScale.Value
  134. local bodyw = plr.Character.Humanoid.BodyWidthScale.Value
  135. local bodyd = plr.Character.Humanoid.BodyDepthScale.Value
  136. local heads = plr.Character.Humanoid.HeadScale.Value
  137. local nearplanez = workspace.CurrentCamera.NearPlaneZ
  138. local remote = plr:WaitForChild("chickennuggetbuttscale")
  139. workspace.Gravity = 0
  140.  
  141. function changeScale(scale)
  142. remote:FireServer(scale,{body,bodyw,bodyd,heads})
  143. workspace.CurrentCamera.CameraSubject = plr.Character.Head--workspace:WaitForChild('ViewPart')
  144. local density = .3*500
  145. local friction = 100
  146. local elasticity = 0
  147. local frictionWeight = 10
  148. local elasticityWeight = 0
  149. -- Construct new PhysicalProperties and set
  150. local physProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
  151. for i,part in pairs(plr.Character:GetDescendants()) do
  152. if part:IsA("BasePart") and part.Name ~= "Head" then
  153. part.CustomPhysicalProperties = physProperties
  154. end
  155. end
  156. plr.Character.Humanoid.WalkSpeed = 16*tonumber(scale)
  157. plr.Character.Humanoid.JumpPower = 50*tonumber(scale)
  158. plr.Character.Animate.ScaleDampeningPercent.Value = 1
  159. local bf = plr.Character.HumanoidRootPart:FindFirstChild("BodyForce")
  160. if bf == nil then
  161. bf = Instance.new("BodyForce",plr.Character.HumanoidRootPart)
  162. end
  163. bf.Force = Vector3.new(0,(-350*500)*((tonumber(scale))^3.9),0)
  164. wait()
  165. wait()
  166. end
  167.  
  168. wait()
  169. changeScale(1)
  170.  
  171. plr.Chatted:Connect(function(msg)
  172. local split = string.split(msg," ")
  173. if string.lower(split[1]) == "/e" and string.lower(split[2]) == "scale" then
  174. if tonumber(split[3]) ~= nil then
  175. changeScale(tonumber(split[3])-0.01)
  176. wait(.1)
  177. changeScale(tonumber(split[3]))
  178. end
  179. end
  180. end)]],owner.PlayerGui)
  181.  
  182. NLS([[local player = game.Players.LocalPlayer
  183. local bin = Instance.new("HopperBin",player.Backpack)
  184. bin.Name = "Fly"
  185. script.Parent = bin
  186.  
  187. local char = player.Character
  188. local torso = char:FindFirstChild("HumanoidRootPart")
  189. local seleted = false
  190. local pos, gyro;
  191. local UserInputService = game:GetService("UserInputService")
  192.  
  193. bin.Selected:connect(function(mouse)
  194. selected = true
  195. pos = Instance.new("BodyPosition", torso)
  196. pos.maxForce = Vector3.new(1,1,1) * 1e99
  197. pos.position = torso.Position
  198. gyro = Instance.new("BodyGyro", torso)
  199. gyro.maxTorque = Vector3.new(1,1,1) * 1e99
  200. local angle = CFrame.new()
  201. touchstart = UserInputService.TouchStarted:connect(function()
  202. button_up = false
  203. angle = CFrame.Angles(-math.rad(70),0,0)
  204. coroutine.resume(coroutine.create(function()
  205. while not button_up do
  206. pos.position = pos.position + (mouse.Hit.p - torso.Position).unit * (10*char.Head.Size.Y)
  207. wait()
  208. end
  209. end))
  210. end)
  211. touchend = UserInputService.TouchEnded:connect(function()
  212. button_up = true
  213. angle = CFrame.new()
  214. end)
  215. mouse.Button1Down:connect(function()
  216. local button_up = false
  217. angle = CFrame.Angles(-math.rad(70),0,0)
  218. coroutine.resume(coroutine.create(function()
  219. while not button_up do
  220. pos.position = pos.position + (mouse.Hit.p - torso.Position).unit * (10*char.Head.Size.Y)
  221. wait()
  222. end
  223. end))
  224. mouse.Button1Up:wait()
  225. button_up = true
  226. angle = CFrame.new()
  227. end)
  228. while selected do
  229. gyro.cframe = CFrame.new(torso.Position, mouse.Hit.p) * angle
  230. wait()
  231. end
  232. end)
  233.  
  234. bin.Deselected:connect(function()
  235. selected = false
  236. touchstart:disconnect()
  237. touchend:Disconnect()
  238. pos:Destroy()
  239. gyro:Destroy()
  240. end)]],owner.Backpack)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement