Advertisement
slowlytrying

flying

May 31st, 2022
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.40 KB | None | 0 0
  1. local Player = game.Players.LocalPlayer
  2. local Character = Player.Character or Player.CharacterAdded:Wait()
  3. local Humanoid = Character:WaitForChild("Humanoid")
  4. local Anim = Instance.new("Animation")
  5. Anim.AnimationId = "rbxassetid://2522658890"
  6. local PlayAnim = Humanoid:LoadAnimation(Anim)
  7. local HumaoidRP = Character:WaitForChild("HumanoidRootPart")
  8. local UIS = game:GetService("UserInputService")
  9. local Mouse = Player:GetMouse()
  10.  
  11.  
  12. local TapTime = .25
  13. local Tapped = false
  14. local Toggle = false
  15.  
  16. UIS.InputBegan:Connect(function(Input)
  17. if Input.KeyCode == Enum.KeyCode.Space then
  18. if not Tapped then
  19. Tapped = true
  20. wait(TapTime)
  21. Tapped = false
  22. else
  23. if Toggle == false then
  24. local Jump = Instance.new("BodyVelocity",HumaoidRP)
  25. Jump.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  26. Jump.Velocity = Vector3.new(0,50,0)
  27. game.Debris:AddItem(Jump,.5)
  28. wait(.5)
  29. HumaoidRP.Anchored = true
  30. Toggle = true
  31. elseif Toggle == true then
  32. Toggle = false
  33. HumaoidRP.Anchored = false
  34. local Children = HumaoidRP:GetChildren()
  35. for i, child in pairs(Children) do
  36. if child:IsA("BodyVelocity") then
  37. child:Destroy()
  38. end
  39. end
  40. end
  41. end
  42. end
  43. end)
  44. UIS.InputBegan:Connect(function(Input)
  45. if Input.KeyCode == Enum.KeyCode.W then
  46. if Toggle == false then return end
  47. PlayAnim:Play()
  48. HumaoidRP.Anchored = false
  49. if HumaoidRP:FindFirstChildOfClass("BodyVelocity") then
  50. HumaoidRP:FindFirstChildOfClass("BodyVelocity"):Destroy()
  51. end
  52. local Forward = Instance.new("BodyVelocity",HumaoidRP)
  53. Forward.Name = "ForwardMovement"
  54. Forward.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  55. local Gyro = Instance.new("BodyGyro",HumaoidRP)
  56. Gyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  57. Gyro.D = 100
  58. Gyro.P = 10000
  59. while Toggle == true do
  60. Forward.Velocity = Mouse.Hit.lookVector*150
  61. Gyro.CFrame = Mouse.Hit
  62. wait()
  63. end
  64. end
  65. end)
  66. UIS.InputEnded:Connect(function(Input)
  67. if Input.KeyCode == Enum.KeyCode.W then
  68. if Toggle == false then return end
  69. if HumaoidRP:FindFirstChild("ForwardMovement") then
  70. HumaoidRP.ForwardMovement:Destroy()
  71. HumaoidRP.Anchored = true
  72. PlayAnim:Stop()
  73. if HumaoidRP:FindFirstChildOfClass("BodyGyro") then
  74. HumaoidRP:FindFirstChildOfClass("BodyGyro"):Destroy()
  75. end
  76. end
  77. end
  78. end)
  79. UIS.InputBegan:Connect(function(Input)
  80. if Input.KeyCode == Enum.KeyCode.S then
  81. if Toggle == false then return end
  82. HumaoidRP.Anchored = false
  83. if HumaoidRP:FindFirstChildOfClass("BodyVelocity") then
  84. HumaoidRP:FindFirstChildOfClass("BodyVelocity"):Destroy()
  85. end
  86. local Back = Instance.new("BodyVelocity",HumaoidRP)
  87. Back.Name = "BackMovement"
  88. Back.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
  89. local Gyro = Instance.new("BodyGyro",HumaoidRP)
  90. Gyro.MaxTorque = Vector3.new(math.huge,math.huge,math.huge)
  91. Gyro.D = 100
  92. Gyro.P = 10000
  93. while Toggle == true do
  94. Back.Velocity = Mouse.Hit.lookVector*-100
  95. Gyro.CFrame = Mouse.Hit
  96. wait()
  97. end
  98. end
  99. end)
  100. UIS.InputEnded:Connect(function(Input)
  101. if Input.KeyCode == Enum.KeyCode.S then
  102. if Toggle == false then return end
  103. if HumaoidRP:FindFirstChild("BackMovement") then
  104. HumaoidRP.BackMovement:Destroy()
  105. HumaoidRP.Anchored = true
  106. if HumaoidRP:FindFirstChildOfClass("BodyGyro") then
  107. HumaoidRP:FindFirstChildOfClass("BodyGyro"):Destroy()
  108. end
  109. end
  110. end
  111. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement