Advertisement
KatieWhitson

Untitled

Jun 24th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1.  
  2.  
  3.  
  4. local mouse = game.Players.LocalPlayer:GetMouse()
  5.  
  6.  
  7.  
  8.  
  9. mouse.KeyDown:connect(function(k)
  10. local key = k:lower()
  11. if key == "z"then
  12.  
  13. print("ga")
  14. local torso = mouse.Target
  15.  
  16. --fly------------------------------------------------
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. -- cam manipulation
  34.  
  35. local target = mouse.Target
  36. local camera = workspace.CurrentCamera
  37. camera.CameraType = Enum.CameraType.Follow
  38. camera.CameraSubject = target
  39.  
  40.  
  41.  
  42.  
  43. --cam manipulation2
  44.  
  45. game:GetService('RunService').Stepped:connect(function()
  46. torso.CanCollide = false
  47. end)
  48.  
  49.  
  50.  
  51.  
  52. local powers = 99
  53.  
  54.  
  55. local bambam = Instance.new("BodyThrust")
  56. bambam.Parent = torso
  57. bambam.Force = Vector3.new(powers,0,powers)
  58. bambam.Location = torso.Position-Vector3.new(0,0,50)
  59.  
  60.  
  61.  
  62.  
  63. local plr = game.Players.LocalPlayer
  64. local torso = mouse.Target
  65. local flying = true
  66. local deb = true
  67. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  68. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  69. local maxspeed = 4000
  70. local speed = 0
  71.  
  72. function Fly()
  73.  
  74. local bv = Instance.new("BodyVelocity", torso)
  75. bv.velocity = Vector3.new(0,0,0)
  76. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  77. repeat wait()
  78.  
  79. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  80. speed = speed+.5+(speed/maxspeed)
  81. if speed > maxspeed then
  82. speed = maxspeed
  83. end
  84. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  85. speed = speed-1
  86. if speed < 0 then
  87. speed = 0
  88. end
  89. end
  90. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  91. bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (ctrl.f+ctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(ctrl.l+ctrl.r,(ctrl.f+ctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed
  92. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  93. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  94. bv.velocity = ((game.Workspace.CurrentCamera.CoordinateFrame.lookVector * (lastctrl.f+lastctrl.b)) + ((game.Workspace.CurrentCamera.CoordinateFrame * CFrame.new(lastctrl.l+lastctrl.r,(lastctrl.f+lastctrl.b)*.2,0).p) - game.Workspace.CurrentCamera.CoordinateFrame.p))*speed
  95. else
  96. bv.velocity = Vector3.new(0,0.1,0)
  97. end
  98.  
  99. until not flying
  100. ctrl = {f = 0, b = 0, l = 0, r = 0}
  101. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  102. speed = 0
  103.  
  104. bv:Destroy()
  105.  
  106. end
  107. mouse.KeyDown:connect(function(key)
  108. if key:lower() == "e" then
  109. if flying then flying = false
  110. else
  111. flying = true
  112. Fly()
  113. end
  114. elseif key:lower() == "w" then
  115. ctrl.f = 1
  116. elseif key:lower() == "s" then
  117. ctrl.b = -1
  118. elseif key:lower() == "a" then
  119. ctrl.l = -1
  120. elseif key:lower() == "d" then
  121. ctrl.r = 1
  122. end
  123. end)
  124. mouse.KeyUp:connect(function(key)
  125. if key:lower() == "w" then
  126. ctrl.f = 0
  127. elseif key:lower() == "s" then
  128. ctrl.b = 0
  129. elseif key:lower() == "a" then
  130. ctrl.l = 0
  131. elseif key:lower() == "d" then
  132. ctrl.r = 0
  133. end
  134. end)
  135. Fly()
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142. --fly
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150. end
  151.  
  152. local hum = game.Players.LocalPlayer.Character.HumanoidRootPart
  153.  
  154. if key == "x" then
  155.  
  156. if mouse.Target then
  157.  
  158. hum.CFrame = CFrame.new(mouse.Hit.x, mouse.Hit.y + 5, mouse.Hit.z)
  159.  
  160. end
  161. end
  162.  
  163. if key == "q" then
  164. local target = game.Players.LocalPlayer.Character.Head
  165. local camera = workspace.CurrentCamera
  166. camera.CameraType = Enum.CameraType.Follow
  167. camera.CameraSubject = target
  168.  
  169. end
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement