ClawedOrb55

Untitled

Jul 24th, 2016
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. local power = 5
  2. wait()
  3. bin = script.Parent
  4. bpos = Instance.new("BodyPosition")
  5. gyro = Instance.new("BodyGyro")
  6. gyro.maxTorque = Vector3.new(math.huge,math.huge,math.huge)
  7. bpos.maxForce = Vector3.new(math.huge,math.huge,math.huge)
  8. fly = false
  9. player = game.Players.LocalPlayer
  10. char = player.Character.Torso
  11. airborne = false
  12.  
  13. function onButton1Down(mouse)
  14. fly = true
  15. while fly do
  16. pos = mouse.Hit.p
  17. --gyro.cframe = CFrame.new(char.Position,pos)
  18. bpos.position = char.Position + (pos-char.Position).unit * power
  19. wait()
  20. end
  21. end
  22.  
  23. function onMove(mouse)
  24. pos = mouse.Hit.p
  25. gyro.cframe = CFrame.new(char.Position,pos) * CFrame.fromEulerAnglesXYZ(-3.14/2+1.2,0,0)
  26. --bpos.position = char.Position +
  27. --wait()
  28. --end
  29. end
  30.  
  31. function onButton1Up(mouse)
  32. fly = false
  33. end
  34.  
  35. function onSelected(mouse)
  36. print("select")
  37. if mouse == nil then
  38. return
  39. end
  40. airborne = true
  41. bpos.Parent = char
  42. bpos.position = char.Position + Vector3.new(0,1,0)
  43. gyro.Parent = char
  44.  
  45. if char.Parent.Humanoid.Sit == true then
  46. char.Parent.Humanoid.Sit = false
  47. wait(.05)
  48. char.Parent.Humanoid.Sit = true
  49. end
  50.  
  51. char.Parent.Humanoid.Sit = true ---
  52. mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
  53. mouse.Button1Down:connect(function() onButton1Down(mouse) end)
  54. mouse.Button1Up:connect(function() onButton1Up(mouse) end)
  55. mouse.Move:connect(function() onMove(mouse) end)
  56.  
  57. for i, v in ipairs(char:GetChildren()) do
  58. if v.className == "Motor" then
  59. v.MaxVelocity = 0
  60. v.CurrentAngle = -1
  61. if v.Name == "Left Hip" then
  62. v.CurrentAngle = 1
  63. end
  64. end
  65. end
  66. end
  67.  
  68. function onDeselected(mouse)
  69. print("deselect")
  70. gyro.Parent = nil
  71. fly = false
  72. airborne = false
  73. for i, v in ipairs(char:GetChildren()) do
  74. if v.className == "Motor" then
  75. v.MaxVelocity = 1
  76. end
  77. end
  78. char.Parent.Humanoid.Sit = false ---
  79. for i = 1, 30 do
  80. if not airborne then
  81. --bpos.position = bpos.position - Vector3.new(0,0,0)
  82. wait(0.01)
  83. end
  84. end
  85. if not airborne then
  86. bpos.Parent = nil
  87. end
  88. end
  89.  
  90.  
  91. bin.Selected:connect(onSelected)
  92. bin.Deselected:connect(onDeselected)
Add Comment
Please, Sign In to add comment