Advertisement
NotCopyright

Flying Script for R6 & R15

Mar 19th, 2020
4,476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. --------------------------------------
  2. Credits to this v3million page
  3.  
  4. https://v3rmillion.net/showthread.php?tid=840716&__cf_chl_jschl_tk__=342d1f2f02600850c88d7cba756ac4f6855d9c7e-1584633351-0-AQ_XQ9vNxuOBMnXzmHcFVdXlkp9CCyb_E2UUwXshqoHWnIQEzPXvaWlKZWMcVGCdbAjg3nxLPqGEX2OD6PWWx8DhYzBhBDurkGLsy0ExYH2xBH5IxM9A30nIgp2NfzeCjWpmY_p8xede6xRyvWMu6S7rf_JQqFWUJv3jus8vx7ceIxf4k3M6yhNPTVR-ex69uF4N777INNWWeCjLlaRwAtkZVs3_iScx5tzEYWakO0rHFr5_dn03_i_OtROfVEScHNhFS1Ybri2Ic-bI5WwLUYt-7JHXZen8PW_BhXfMz5KecuEODaYu1yM-f4dqbrWwMg
  5.  
  6. Dont copy any of this between the - - lines just the script
  7. --------------------------------------
  8. local humanoid = game:GetService("Players").LocalPlayer.Character.Humanoid
  9. if humanoid.RigType == Enum.HumanoidRigType.R15 then
  10. game:GetService('Players').LocalPlayer.Character.Humanoid.Name = "Humanoida"
  11. repeat wait()
  12. until game:GetService"Players".LocalPlayer and game:GetService"Players".LocalPlayer.Character and game:GetService"Players".LocalPlayer.Character:findFirstChild("UpperTorso") and game:GetService"Players".LocalPlayer.Character:findFirstChild("Humanoida")
  13. local mouse = game:GetService"Players".LocalPlayer:GetMouse()
  14. repeat wait() until mouse
  15. local plr = game:GetService"Players".LocalPlayer
  16. local torso = plr.Character.UpperTorso
  17. local flying = true
  18. local deb = true
  19. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  20. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  21. local maxspeed = 100
  22. local speed = 0
  23. function Fly()
  24. local bg = Instance.new("BodyGyro", torso)
  25. bg.P = 9e4
  26. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  27. bg.cframe = torso.CFrame
  28. local bv = Instance.new("BodyVelocity", torso)
  29. bv.velocity = Vector3.new(0,0.1,0)
  30. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  31. repeat wait()
  32. plr.Character.Humanoida.PlatformStand = true
  33. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  34. speed = speed+.5+(speed/maxspeed)
  35. if speed > maxspeed then
  36. speed = maxspeed
  37. end
  38. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  39. speed = speed-1
  40. if speed < 0 then
  41. speed = 0
  42. end
  43. end
  44. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  45. bv.velocity = ((game:GetService("Workspace").CurrentCamera.CoordinateFrame.lookVector * (ctrl.f+ctrl.b)) + ((game:GetService("Workspace").CurrentCamera.CoordinateFrame * CFrame.new(ctrl.l+ctrl.r,(ctrl.f+ctrl.b)*.2,0).p) - game:GetService("Workspace").CurrentCamera.CoordinateFrame.p))*speed
  46. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  47. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  48. bv.velocity = ((game:GetService("Workspace").CurrentCamera.CoordinateFrame.lookVector * (lastctrl.f+lastctrl.b)) + ((game:GetService("Workspace").CurrentCamera.CoordinateFrame * CFrame.new(lastctrl.l+lastctrl.r,(lastctrl.f+lastctrl.b)*.2,0).p) - game:GetService("Workspace").CurrentCamera.CoordinateFrame.p))*speed
  49. else
  50. bv.velocity = Vector3.new(0,0.1,0)
  51. end
  52. bg.cframe = game:GetService("Workspace").CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  53. until not flying
  54. ctrl = {f = 0, b = 0, l = 0, r = 0}
  55. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  56. speed = 0
  57. bg:Destroy()
  58. bv:Destroy()
  59. plr.Character.Humanoida.PlatformStand = false
  60. end
  61. mouse.KeyDown:connect(function(key)
  62. if key:lower() == "e" then
  63. if flying then flying = false
  64. else
  65. flying = true
  66. Fly()
  67. end
  68. elseif key:lower() == "w" then
  69. ctrl.f = 1
  70. elseif key:lower() == "s" then
  71. ctrl.b = -1
  72. elseif key:lower() == "a" then
  73. ctrl.l = -1
  74. elseif key:lower() == "d" then
  75. ctrl.r = 1
  76. end
  77. end)
  78. mouse.KeyUp:connect(function(key)
  79. if key:lower() == "w" then
  80. ctrl.f = 0
  81. elseif key:lower() == "s" then
  82. ctrl.b = 0
  83. elseif key:lower() == "a" then
  84. ctrl.l = 0
  85. elseif key:lower() == "d" then
  86. ctrl.r = 0
  87. end
  88. end)
  89. Fly()
  90. else
  91. repeat wait()
  92. until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  93. local mouse = game.Players.LocalPlayer:GetMouse()
  94. repeat wait() until mouse
  95. local plr = game.Players.LocalPlayer
  96. local torso = plr.Character.Torso
  97. local flying = true
  98. local deb = true
  99. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  100. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  101. local maxspeed = 50
  102. local speed = 0
  103.  
  104. function Fly()
  105. local bg = Instance.new("BodyGyro", torso)
  106. bg.P = 9e4
  107. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  108. bg.cframe = torso.CFrame
  109. local bv = Instance.new("BodyVelocity", torso)
  110. bv.velocity = Vector3.new(0,0.1,0)
  111. bv.maxForce = Vector3.new(9e9, 9e9, 9e9)
  112. repeat wait()
  113. plr.Character.Humanoid.PlatformStand = true
  114. if ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0 then
  115. speed = speed+.5+(speed/maxspeed)
  116. if speed > maxspeed then
  117. speed = maxspeed
  118. end
  119. elseif not (ctrl.l + ctrl.r ~= 0 or ctrl.f + ctrl.b ~= 0) and speed ~= 0 then
  120. speed = speed-1
  121. if speed < 0 then
  122. speed = 0
  123. end
  124. end
  125. if (ctrl.l + ctrl.r) ~= 0 or (ctrl.f + ctrl.b) ~= 0 then
  126. 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
  127. lastctrl = {f = ctrl.f, b = ctrl.b, l = ctrl.l, r = ctrl.r}
  128. elseif (ctrl.l + ctrl.r) == 0 and (ctrl.f + ctrl.b) == 0 and speed ~= 0 then
  129. 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
  130. else
  131. bv.velocity = Vector3.new(0,0.1,0)
  132. end
  133. bg.cframe = game.Workspace.CurrentCamera.CoordinateFrame * CFrame.Angles(-math.rad((ctrl.f+ctrl.b)*50*speed/maxspeed),0,0)
  134. until not flying
  135. ctrl = {f = 0, b = 0, l = 0, r = 0}
  136. lastctrl = {f = 0, b = 0, l = 0, r = 0}
  137. speed = 0
  138. bg:Destroy()
  139. bv:Destroy()
  140. plr.Character.Humanoid.PlatformStand = false
  141. end
  142. mouse.KeyDown:connect(function(key)
  143. if key:lower() == "e" then
  144. if flying then flying = false
  145. else
  146. flying = true
  147. Fly()
  148. end
  149. elseif key:lower() == "w" then
  150. ctrl.f = 1
  151. elseif key:lower() == "s" then
  152. ctrl.b = -1
  153. elseif key:lower() == "a" then
  154. ctrl.l = -1
  155. elseif key:lower() == "d" then
  156. ctrl.r = 1
  157. end
  158. end)
  159. mouse.KeyUp:connect(function(key)
  160. if key:lower() == "w" then
  161. ctrl.f = 0
  162. elseif key:lower() == "s" then
  163. ctrl.b = 0
  164. elseif key:lower() == "a" then
  165. ctrl.l = 0
  166. elseif key:lower() == "d" then
  167. ctrl.r = 0
  168. end
  169. end)
  170. Fly()
  171. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement