Advertisement
Guest User

Untitled

a guest
Sep 13th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.41 KB | None | 0 0
  1. local inputService = game:GetService("UserInputService")
  2. local ios = false
  3. if inputService.TouchEnabled and inputService.KeyboardEnabled == false then
  4. ios = true
  5. end
  6. Name = "Fly"
  7. pi = math.pi
  8. a = 0
  9. s = 0
  10. ndist = -30
  11. rs = 0.025
  12. siz = Vector3.new(1, 1, 1)
  13. form = 0
  14. flow = {}
  15. function CFC(P1, P2)
  16. local Place0 = CFrame.new(P1.CFrame.x, P1.CFrame.y, P1.CFrame.z)
  17. local Place1 = P2.Position
  18. P1.Size = Vector3.new(P1.Size.x, P1.Size.y, (Place0.p - Place1).magnitude)
  19. P1.CFrame = CFrame.new((Place0.p + Place1) / 2, Place0.p)
  20. end
  21. function checktable(table, parentneeded)
  22. local i
  23. local t = {}
  24. for i = 1, #table do
  25. if table[i] ~= nil and string.lower(type(table[i])) == "userdata" then
  26. if parentneeded == true then
  27. if table[i].Parent ~= nil then
  28. t[#t + 1] = table[i]
  29. end
  30. else
  31. t[#t + 1] = table[i]
  32. end
  33. end
  34. end
  35. return t
  36. end
  37. if script.Parent.Name ~= Name then
  38. User = game:service("Players").Nineza
  39. HB = Instance.new("HopperBin")
  40. HB.Name = Name
  41. HB.Parent = User.StarterGear
  42. script.Parent = HB
  43. User.Character:BreakJoints()
  44. end
  45. speed = 200
  46. script.Parent.Selected:connect(function(mar)
  47. s = 1
  48. torso = script.Parent.Parent.Parent.Character.Torso
  49. LeftShoulder = torso["Left Shoulder"]
  50. RightShoulder = torso["Right Shoulder"]
  51. LeftHip = torso["Left Hip"]
  52. RightHip = torso["Right Hip"]
  53. human = script.Parent.Parent.Parent.Character.Humanoid
  54. bv = Instance.new("BodyVelocity")
  55. bv.maxForce = Vector3.new(0, math.huge, 0)
  56. bv.velocity = Vector3.new(0, 0, 0)
  57. bv.Parent = torso
  58. bg = Instance.new("BodyGyro")
  59. bg.maxTorque = Vector3.new(0, 0, 0)
  60. bg.Parent = torso
  61. if not ios then
  62. connection = mar.Button1Down:connect(function()
  63. a = 1
  64. bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  65. bg.maxTorque = Vector3.new(900000, 900000, 900000)
  66. bg.cframe = CFrame.new(torso.Position, mar.hit.p) * CFrame.Angles(math.rad(-90), 0, 0)
  67. bv.velocity = CFrame.new(torso.Position, mar.hit.p).lookVector * speed
  68. moveconnect = mar.Move:connect(function()
  69. bg.maxTorque = Vector3.new(900000, 900000, 900000)
  70. bg.cframe = CFrame.new(torso.Position, mar.hit.p) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
  71. bv.velocity = CFrame.new(torso.Position, mar.hit.p).lookVector * speed
  72. end)
  73. upconnect = mar.Button1Up:connect(function()
  74. a = 0
  75. moveconnect:disconnect()
  76. upconnect:disconnect()
  77. bv.velocity = Vector3.new(0, 0, 0)
  78. bv.maxForce = Vector3.new(0, math.huge, 0)
  79. torso.Velocity = Vector3.new(0, 0, 0)
  80. bg.cframe = CFrame.new(torso.Position, torso.Position + Vector3.new(torso.CFrame.lookVector.x, 0, torso.CFrame.lookVector.z))
  81. wait(1)
  82. end)
  83. end)
  84. else
  85. connection = inputService.TouchTap:connect(function(mp, n, event)
  86. if event then
  87. return
  88. end
  89. a = 1
  90. bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  91. bg.maxTorque = Vector3.new(900000, 900000, 900000)
  92. bg.cframe = CFrame.new(torso.Position, mar.hit.p) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
  93. bv.velocity = CFrame.new(torso.Position, mar.hit.p).lookVector * speed
  94. moveconnect = inputService.TouchMoved:connect(function(obj, event)
  95. if event then
  96. return
  97. end
  98. bg.maxTorque = Vector3.new(900000, 900000, 900000)
  99. bg.cframe = CFrame.new(torso.Position, mar.hit.p) * CFrame.fromEulerAnglesXYZ(math.rad(-90), 0, 0)
  100. bv.velocity = CFrame.new(torso.Position, mar.hit.p).lookVector * speed
  101. end)
  102. upconnect = inputService.TouchEnded:connect(function()
  103. a = 0
  104. moveconnect:disconnect()
  105. upconnect:disconnect()
  106. bv.velocity = Vector3.new(0, 0, 0)
  107. bv.maxForce = Vector3.new(0, math.huge, 0)
  108. torso.Velocity = Vector3.new(0, 0, 0)
  109. bg.cframe = CFrame.new(torso.Position, torso.Position + Vector3.new(torso.CFrame.lookVector.x, 0, torso.CFrame.lookVector.z))
  110. wait(1)
  111. end)
  112. end)
  113. end
  114. while s == 1 do
  115. wait(0.02)
  116. flow = checktable(flow, true)
  117. local i
  118. for i = 1, #flow do
  119. flow[i].Transparency = flow[i].Transparency + rs
  120. if 1 <= flow[i].Transparency then
  121. flow[i]:Destroy()
  122. end
  123. end
  124. if a == 1 then
  125. local amplitude, frequency
  126. amplitude = pi
  127. desiredAngle = amplitude
  128. RightShoulder.MaxVelocity = 0.4
  129. LeftShoulder.MaxVelocity = 0.4
  130. RightHip.MaxVelocity = pi / 10
  131. LeftHip.MaxVelocity = pi / 10
  132. RightShoulder.DesiredAngle = desiredAngle
  133. LeftShoulder.DesiredAngle = -desiredAngle
  134. RightHip.DesiredAngle = 0
  135. LeftHip.DesiredAngle = 0
  136. end
  137. end
  138. end)
  139. script.Parent.Deselected:connect(function()
  140. a = 0
  141. s = 0
  142. bv:Destroy()
  143. bg:Destroy()
  144. if connection ~= nil then
  145. connection:disconnect()
  146. end
  147. if moveconnect ~= nil then
  148. moveconnect:disconnect()
  149. end
  150. if upconnect ~= nil then
  151. upconnect:disconnect()
  152. end
  153. while s == 0 do
  154. wait()
  155. if 0 < #flow then
  156. flow = checktable(flow, true)
  157. local i
  158. for i = 1, #flow do
  159. flow[i].Transparency = flow[i].Transparency + rs
  160. if 1 <= flow[i].Transparency then
  161. flow[i]:Destroy()
  162. end
  163. end
  164. end
  165. end
  166. end)
  167. while true do
  168. wait()
  169. if s == 1 then
  170. return
  171. end
  172. end
  173. script:Destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement