Advertisement
ZKCMCheats

Fly (idk does it works)

Mar 17th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.74 KB | None | 0 0
  1. -flying = false to disable flying
  2. -before it was press “e” to disable but now I changed —-it but idk does it work (if I’m in home I will delete —-this).
  3.  
  4. repeat wait()
  5.    until game.Players.LocalPlayer and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:findFirstChild("Torso") and game.Players.LocalPlayer.Character:findFirstChild("Humanoid")
  6. local mouse = game.Players.LocalPlayer:GetMouse()
  7. repeat wait() until mouse
  8. local plr = game.Players.LocalPlayer
  9. local torso = plr.Character.Torso
  10. local flying = true
  11. local deb = true
  12. local ctrl = {f = 0, b = 0, l = 0, r = 0}
  13. local lastctrl = {f = 0, b = 0, l = 0, r = 0}
  14. local maxspeed = 50
  15. local speed = 0
  16.  
  17. function Fly()
  18. local bg = Instance.new("BodyGyro", torso)
  19. bg.P = 9e4
  20. bg.maxTorque = Vector3.new(9e9, 9e9, 9e9)
  21. bg.cframe = torso.CFrame
  22. local bv = Instance.new("BodyVelocity", torso)
  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. elseif key:lower() == "w" then
  56. ctrl.f = 1
  57. elseif key:lower() == "s" then
  58. ctrl.b = -1
  59. elseif key:lower() == "a" then
  60. ctrl.l = -1
  61. elseif key:lower() == "d" then
  62. ctrl.r = 1
  63. end
  64. end)
  65. mouse.KeyUp:connect(function(key)
  66. if key:lower() == "w" then
  67. ctrl.f = 0
  68. elseif key:lower() == "s" then
  69. ctrl.b = 0
  70. elseif key:lower() == "a" then
  71. ctrl.l = 0
  72. elseif key:lower() == "d" then
  73. ctrl.r = 0
  74. end
  75. end)
  76. Fly()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement