LOl2x234

ts2 fly

Dec 13th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.11 KB | None | 0 0
  1. local LP = game.Players.LocalPlayer
  2. local Mouse = LP:GetMouse()
  3. toggler = false
  4.  
  5. FLYING = false
  6. iyflyspeed = 5
  7. function sFLY() -- from rocky2u cmdscript
  8.  
  9. repeat wait() until LP and LP.Character and LP.Character:FindFirstChild('HumanoidRootPart') and LP.Character:FindFirstChild('Humanoid')
  10. game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = true
  11. repeat wait() until Mouse
  12. local T = game.Players.LocalPlayer.Character.HumanoidRootPart
  13. local CONTROL = {F = 0, B = 0, L = 0, R = 0}
  14. local lCONTROL = {F = 0, B = 0, L = 0, R = 0}
  15. local SPEED = 0
  16.  
  17. local function FLY()
  18. FLYING = true
  19. local BG = Instance.new('BodyGyro', T)
  20. local BV = Instance.new('BodyVelocity', T)
  21. BG.P = 9e4
  22. BG.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  23. BG.cframe = T.CFrame
  24. BV.velocity = Vector3.new(0, 0.1, 0)
  25. BV.maxForce = Vector3.new(9e9, 9e9, 9e9)
  26. spawn(function()
  27. repeat wait()
  28.  
  29. if CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0 then
  30. SPEED = 50
  31. elseif not (CONTROL.L + CONTROL.R ~= 0 or CONTROL.F + CONTROL.B ~= 0) and SPEED ~= 0 then
  32. SPEED = 0
  33. end
  34. if (CONTROL.L + CONTROL.R) ~= 0 or (CONTROL.F + CONTROL.B) ~= 0 then
  35. BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (CONTROL.F + CONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(CONTROL.L + CONTROL.R, (CONTROL.F + CONTROL.B) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
  36. lCONTROL = {F = CONTROL.F, B = CONTROL.B, L = CONTROL.L, R = CONTROL.R}
  37. elseif (CONTROL.L + CONTROL.R) == 0 and (CONTROL.F + CONTROL.B) == 0 and SPEED ~= 0 then
  38. BV.velocity = ((workspace.CurrentCamera.CoordinateFrame.lookVector * (lCONTROL.F + lCONTROL.B)) + ((workspace.CurrentCamera.CoordinateFrame * CFrame.new(lCONTROL.L + lCONTROL.R, (lCONTROL.F + lCONTROL.B) * 0.2, 0).p) - workspace.CurrentCamera.CoordinateFrame.p)) * SPEED
  39. else
  40. BV.velocity = Vector3.new(0, 0.1, 0)
  41. end
  42. BG.cframe = workspace.CurrentCamera.CoordinateFrame
  43. until not FLYING
  44. CONTROL = {F = 0, B = 0, L = 0, R = 0}
  45. lCONTROL = {F = 0, B = 0, L = 0, R = 0}
  46. SPEED = 0
  47. BG:destroy()
  48. BV:destroy()
  49. end)
  50. end
  51. Mouse.KeyDown:connect(function(KEY)
  52. if KEY:lower() == 'w' then
  53. CONTROL.F = iyflyspeed
  54. elseif KEY:lower() == 's' then
  55. CONTROL.B = -iyflyspeed
  56. elseif KEY:lower() == 'a' then
  57. CONTROL.L = -iyflyspeed
  58. elseif KEY:lower() == 'd' then
  59. CONTROL.R = iyflyspeed
  60. end
  61. end)
  62. Mouse.KeyUp:connect(function(KEY)
  63. if KEY:lower() == 'w' then
  64. CONTROL.F = 0
  65. elseif KEY:lower() == 's' then
  66. CONTROL.B = 0
  67. elseif KEY:lower() == 'a' then
  68. CONTROL.L = 0
  69. elseif KEY:lower() == 'd' then
  70. CONTROL.R = 0
  71. end
  72. end)
  73. FLY()
  74. game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false
  75. end
  76.  
  77.  
  78. function NOFLY()
  79. FLYING = false
  80. end
  81.  
  82. function startflying()
  83. game.Players.LocalPlayer.PlayerGui.LocalScript.Disabled = true
  84. wait()
  85. sFLY()
  86. wait(0.1)
  87. game.Players.LocalPlayer.PlayerGui.LocalScript.Disabled = false
  88. local Float = Instance.new('Part', game.Players.LocalPlayer.Character)
  89. Float.Name = 'Float'
  90. Float.Transparency = 1
  91. Float.Size = Vector3.new(6,1,6)
  92. Float.Anchored = true
  93. end
  94.  
  95. Mouse.KeyDown:Connect(function(key)
  96. if key == "h" then
  97. game.Players.LocalPlayer.Character.Animate.fall.FallAnim.AnimationId = "http://www.roblox.com/asset/?id=1132469004"
  98. if not toggler then
  99. toggler = true
  100. startflying()
  101. elseif toggler then
  102. toggler = false
  103. NOFLY()
  104. if game.Players.LocalPlayer.Character then
  105. if game.Players.LocalPlayer.Character:FindFirstChild("Float") then
  106. game.Players.LocalPlayer.Character:FindFirstChild("Float"):Destroy()
  107. end
  108. end
  109. end
  110.  
  111. end
  112. end)
  113.  
Add Comment
Please, Sign In to add comment