SHARE
TWEET

Untitled

Vzurxy Sep 23rd, 2018 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. repeat wait()
  2. until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("UpperTorso") and game.Players.LocalPlayer.Character:FindFirstChild("Humanoid")
  3.  
  4. local mouse = game.Players.LocalPlayer:GetMouse()
  5. repeat wait() until mouse
  6.   local plr = game.Players.LocalPlayer
  7.   local torso = plr.Character.UpperTorso
  8.   local flying = true
  9.   local deb = true
  10.   local ctrl = {f = 0, b = 0, l = 0, r = 0}
  11.   local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  12.   local maxspeed = 50
  13.   local speed = 0
  14.  
  15.   function MainFly()
  16.     local bg = Instance.new("BodyGyro", torso)
  17.     bg.Name = math.random(1,99999999)
  18.     bg.P = 9e4
  19.     bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  20.     bg.cframe = torso.CFrame
  21.     local bv = Instance.new("BodyVelocity", torso)
  22.     bv.Name = math.random(1,99999999)
  23.     bv.velocity = Vector3.new(0,0.1,0)
  24.     bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  25.     repeat wait()
  26.       plr.Character.Humanoid.PlatformStand = true
  27.       if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  28.         speed = speed+.5+(speed/maxspeed)
  29.         if speed > maxspeed then
  30.           speed = maxspeed
  31.         end
  32.       elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  33.         speed = speed-1
  34.         if speed < 0 then
  35.           speed = 0
  36.         end
  37.       end
  38.       if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  39.         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
  40.         lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  41.       elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  42.         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
  43.       else
  44.         bv.velocity = Vector3.new(0,0.1,0)
  45.       end
  46.       bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  47.     until not flying
  48.     ctrl = {f = 0, b = 0, l = 0, r = 0}
  49.     lastctrl = {f = 0, b = 0, l = 0, r = 0}
  50.     speed = 0
  51.     bg:Destroy()
  52.     bv:Destroy()
  53.     plr.Character.Humanoid.PlatformStand = false
  54.   end
  55.   mouse.KeyDown:connect(function(key)
  56.   if key:lower() == "e" then
  57.     if flying then flying = false
  58.   else
  59.     flying = true
  60.     MainFly()
  61.   end
  62. elseif key:lower() == "w" then
  63.   ctrl.f = 1
  64. elseif key:lower() == "s" then
  65.   ctrl.b = -1
  66. elseif key:lower() == "a" then
  67.   ctrl.l = -1
  68. elseif key:lower() == "d" then
  69.   ctrl.r = 1
  70. end
  71. end)
  72. mouse.KeyUp:connect(function(key)
  73. if key:lower() == "w" then
  74.   ctrl.f = 0
  75. elseif key:lower() == "s" then
  76.   ctrl.b = 0
  77. elseif key:lower() == "a" then
  78.   ctrl.l = 0
  79. elseif key:lower() == "d" then
  80.   ctrl.r = 0
  81. end
  82. end)
  83. MainFly()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top