Advertisement
HenloMyDude

fly (r15 and r6 compatible)

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