Advertisement
TurtleWars

Fly Hub

Jul 26th, 2020 (edited)
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1. -- Created By Iplayvlogs
  2.  
  3. local ScreenGui = Instance.new("ScreenGui")
  4. local fly = Instance.new("Frame")
  5. local title = Instance.new("TextLabel")
  6. local close = Instance.new("TextButton")
  7. local enable = Instance.new("TextButton")
  8.  
  9. --Properties:
  10.  
  11. ScreenGui.Parent = game.Players.LocalPlayer:WaitForChild("PlayerGui")
  12.  
  13. fly.Name = "fly"
  14. fly.Parent = ScreenGui
  15. fly.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  16. fly.Position = UDim2.new(0.139573067, 0, 0.478705257, 0)
  17. fly.Size = UDim2.new(0, 234, 0, 136)
  18.  
  19. title.Name = "title"
  20. title.Parent = fly
  21. title.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  22. title.BorderColor3 = Color3.fromRGB(27, 42, 53)
  23. title.Size = UDim2.new(0, 175, 0, 50)
  24. title.Font = Enum.Font.SciFi
  25. title.Text = "Fly Hub"
  26. title.TextColor3 = Color3.fromRGB(255, 255, 255)
  27. title.TextScaled = true
  28. title.TextSize = 14.000
  29. title.TextWrapped = true
  30.  
  31. close.Name = "close"
  32. close.Parent = fly
  33. close.BackgroundColor3 = Color3.fromRGB(170, 0, 0)
  34. close.Position = UDim2.new(0.747863233, 0, 0, 0)
  35. close.Size = UDim2.new(0, 59, 0, 50)
  36. close.Font = Enum.Font.SourceSans
  37. close.Text = "X"
  38. close.TextColor3 = Color3.fromRGB(0, 0, 0)
  39. close.TextScaled = true
  40. close.TextSize = 14.000
  41. close.TextWrapped = true
  42. close.MouseButton1Down:connect(function()
  43. fly.Visible = false
  44. end)
  45.  
  46. enable.Name = "enable"
  47. enable.Parent = fly
  48. enable.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
  49. enable.Position = UDim2.new(0, 0, 0.367647052, 0)
  50. enable.Size = UDim2.new(0, 234, 0, 86)
  51. enable.Font = Enum.Font.SourceSans
  52. enable.Text = "Enable Flying"
  53. enable.TextColor3 = Color3.fromRGB(255, 255, 255)
  54. enable.TextScaled = true
  55. enable.TextSize = 14.000
  56. enable.TextWrapped = true
  57. enable.MouseButton1Down:connect(function()
  58. repeat wait()
  59. until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Head") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  60. local mouse = game.Players.LocalPlayer:GetMouse()
  61. repeat wait() until mouse
  62. local plr = game.Players.LocalPlayer
  63. local torso = plr.Character.Head
  64. local flying = false
  65. local deb = true
  66. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  67. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  68. local maxspeed = 50
  69. local speed = 0
  70.  
  71. function Fly()
  72. local bg = Instance.new("BodyGyro", torso)
  73. bg.P = 9e4
  74. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  75. bg.cframe = torso.CFrame
  76. local bv = Instance.new("BodyVelocity", torso)
  77. bv.velocity = Vector3.new(0,0.1,0)
  78. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  79. repeat wait()
  80. plr.Character.Humanoid.PlatformStand = true
  81. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  82. speed = speed+.5+(speed/maxspeed)
  83. if speed > maxspeed then
  84. speed = maxspeed
  85. end
  86. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  87. speed = speed-1
  88. if speed < 0 then
  89. speed = 0
  90. end
  91. end
  92. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  93. 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
  94. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  95. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  96. 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
  97. else
  98. bv.velocity = Vector3.new(0,0.1,0)
  99. end
  100. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  101. until not flying
  102. ctrl = {f = 0, b = 0, l = 0, r = 0}
  103. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  104. speed = 0
  105. bg:Destroy()
  106. bv:Destroy()
  107. plr.Character.Humanoid.PlatformStand = false
  108. end
  109. mouse.KeyDown:connect(function(key)
  110. if key:lower() == "e" then
  111. if flying then flying = false
  112. else
  113. flying = true
  114. Fly()
  115. end
  116. elseif key:lower() == "w" then
  117. ctrl.f = 1
  118. elseif key:lower() == "s" then
  119. ctrl.b = -1
  120. elseif key:lower() == "a" then
  121. ctrl.l = -1
  122. elseif key:lower() == "d" then
  123. ctrl.r = 1
  124. end
  125. end)
  126. mouse.KeyUp:connect(function(key)
  127. if key:lower() == "w" then
  128. ctrl.f = 0
  129. elseif key:lower() == "s" then
  130. ctrl.b = 0
  131. elseif key:lower() == "a" then
  132. ctrl.l = 0
  133. elseif key:lower() == "d" then
  134. ctrl.r = 0
  135. end
  136. end)
  137. Fly()
  138. enable.Text = "Press E to fly and unfly"
  139. enable.TextSize = 10.000
  140. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement