Advertisement
ExodiaForce

exofly

Nov 9th, 2024 (edited)
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.78 KB | None | 0 0
  1. FLYING = false
  2. CONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
  3. lCONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
  4. SPEED = 0
  5. p = {}
  6. Players = game.Players
  7. local function enablef(stat)
  8. FLYING = stat
  9. local BG = Instance.new('BodyGyro')
  10. local BV = Instance.new('BodyVelocity')
  11. BG.P = 9999
  12. BG.Parent = game.Players.LocalPlayer.Character.PrimaryPart
  13. BV.Parent = game.Players.LocalPlayer.Character.PrimaryPart
  14. BG.maxTorque = Vector3.new(99999999, 99999999, 99999999)
  15. BG.cframe = game.Players.LocalPlayer.Character.PrimaryPart.CFrame
  16. BV.velocity = Vector3.new(0, 0, 0)
  17. BV.maxForce = Vector3.new(99999999, 99999999, 99999999)
  18. task.spawn(function()
  19. repeat task.wait()
  20. if not vfly and Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid') then
  21. Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid').PlatformStand = true
  22. end
  23. if CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0 or CONTROL.Q + CONTROL.E ~= 0 then
  24. SPEED = 50
  25. elseif not (CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0 or CONTROL.Q + CONTROL.E ~= 0) and SPEED ~= 0 then
  26. SPEED = 0
  27. end
  28. if (CONTROL.L + CONTROL.R) ~= 0 or (CONTROL.F + CONTROL.B) ~= 0 or (CONTROL.Q + CONTROL.E) ~= 0 then
  29. BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (CONTROL.F + CONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(CONTROL.L + CONTROL.R, (CONTROL.F + CONTROL.B + CONTROL.Q + CONTROL.E) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
  30. lCONTROL = {F = CONTROL.F, B = CONTROL.B, L = CONTROL.L, R = CONTROL.R}
  31. elseif (CONTROL.L + CONTROL.R) == 0 and (CONTROL.F + CONTROL.B) == 0 and (CONTROL.Q + CONTROL.E) == 0 and SPEED ~= 0 then
  32. BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (lCONTROL.F + lCONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(lCONTROL.L + lCONTROL.R, (lCONTROL.F + lCONTROL.B + CONTROL.Q + CONTROL.E) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
  33. else
  34. BV.velocity = Vector3.new(0, 0, 0)
  35. end
  36. BG.cframe = workspace.CurrentCamera.CoordinateFrame
  37. until not FLYING
  38. CONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
  39. lCONTROL = {F = 0, B = 0, L = 0, R = 0, Q = 0, E = 0}
  40. SPEED = 0
  41. BG:Destroy()
  42. BV:Destroy()
  43. if Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid') then
  44. Players.LocalPlayer.Character:FindFirstChildOfClass('Humanoid').PlatformStand = false
  45. end
  46. end)
  47. end
  48. game.UserInputService.InputBegan:Connect(function(i,gpe)
  49. if i.KeyCode == Enum.KeyCode.LeftBracket then
  50. if not FLYING then
  51. for i,v in ipairs(game.Players.LocalPlayer.Character:GetDescendants()) do
  52. if v:IsA("BasePart") then
  53. if v.CanCollide == true then
  54. table.insert(p,v)
  55. local c = v.Changed:Connect(function()
  56. if v.CanCollide == true then
  57. v.CanCollide = false
  58. end
  59. end)
  60. v.CanCollide = false
  61. coroutine.wrap(function()
  62. repeat task.wait() until not FLYING
  63. c:Disconnect()
  64. end)
  65. end
  66. end
  67. end
  68. else
  69. for i,v in pairs(p) do
  70. v.CanCollide = true
  71. end
  72. table.clear(p)
  73. end
  74. if FLYING then
  75. enablef(false)
  76. else
  77. enablef(true)
  78. end
  79. end
  80. end)
  81. iyflyspeed = 2.5
  82. vehicleflyspeed = 2.5
  83. IYMouse = Players.LocalPlayer:GetMouse()
  84. flyKeyDown = IYMouse.KeyDown:Connect(function(KEY)
  85. if KEY:lower() == 'w' then
  86. CONTROL.F = (vfly and vehicleflyspeed or iyflyspeed)
  87. elseif KEY:lower() == 's' then
  88. CONTROL.B = - (vfly and vehicleflyspeed or iyflyspeed)
  89. elseif KEY:lower() == 'a' then
  90. CONTROL.L = - (vfly and vehicleflyspeed or iyflyspeed)
  91. elseif KEY:lower() == 'd' then
  92. CONTROL.R = (vfly and vehicleflyspeed or iyflyspeed)
  93. elseif QEfly and KEY:lower() == 'e' then
  94. CONTROL.Q = (vfly and vehicleflyspeed or iyflyspeed)*2
  95. elseif QEfly and KEY:lower() == 'q' then
  96. CONTROL.E = -(vfly and vehicleflyspeed or iyflyspeed)*2
  97. end
  98. pcall(function() workspace.CurrentCamera.CameraType = Enum.CameraType.Track end)
  99. end)
  100. flyKeyUp = IYMouse.KeyUp:Connect(function(KEY)
  101. if KEY:lower() == 'w' then
  102. CONTROL.F = 0
  103. elseif KEY:lower() == 's' then
  104. CONTROL.B = 0
  105. elseif KEY:lower() == 'a' then
  106. CONTROL.L = 0
  107. elseif KEY:lower() == 'd' then
  108. CONTROL.R = 0
  109. elseif KEY:lower() == 'e' then
  110. CONTROL.Q = 0
  111. elseif KEY:lower() == 'q' then
  112. CONTROL.E = 0
  113. end
  114. end)
  115. game:GetService("RunService").PreRender:Connect(function()
  116. if FLYING then
  117. game.Players.LocalPlayer.Character.Torso.CanCollide = false
  118. game.Players.LocalPlayer.Character.PrimaryPart.AssemblyLinearVelocity = Vector3.zero
  119. end
  120. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement