Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. local RunService = game:GetService("RunService")
  2.  
  3. local Player = game.Players.LocalPlayer
  4. local PlayerGui = Player.PlayerGui
  5. local Camera = workspace.CurrentCamera
  6. local Character = Player.Character
  7. local Humanoid = Character:WaitForChild("Humanoid")
  8. local Drone = workspace.Drones:FindFirstChild(Character.Name)
  9.  
  10. local ClientGui = PlayerGui:WaitForChild("Client")
  11.  
  12. local Button = Instance.new("TextButton")
  13. Button.BackgroundColor3 = Color3.fromRGB(33,33,33)
  14. Button.TextColor3 = Color3.fromRGB(255,255,255)
  15. Button.TextSize = 20
  16. Button.Font = Enum.Font.SourceSansBold
  17. Button.Text = "Toggle"
  18. Button.Size = UDim2.new(0.1,0,0.048, 0)
  19. Button.Position = UDim2.new(0.008, 0, 0.861, 0)
  20.  
  21. local Torque = 400000
  22. local Force = 4000
  23. local BPForce = 5000
  24.  
  25. local Following = false
  26.  
  27. if Drone then
  28. -- printoutput("Drone found")
  29.  
  30. --UI
  31. local Gui = Instance.new("ScreenGui")
  32. Gui.Parent = game.CoreGui
  33. Gui.Name = "DroneSense"
  34.  
  35. local ToggleViewButton = Button:Clone()
  36. ToggleViewButton.Text = "ToggleView"
  37. ToggleViewButton.Parent = Gui
  38.  
  39. local ToggleFollowButton = Button:Clone()
  40. ToggleFollowButton.Text = "ToggleFollow"
  41. ToggleFollowButton.Position = UDim2.new(0.008, 0, 0.801, 0)
  42. ToggleFollowButton.Parent = Gui
  43.  
  44. _G.CurrentView = "Drone"
  45.  
  46. local DroneCam = Drone:FindFirstChild("Cam")
  47. local DroneBV = Drone:FindFirstChild("FlightVelocity")
  48. local AnchorBV = DroneBV:Clone() --To keep drone suspended but not moving.
  49. AnchorBV.Name = "Anchor"
  50. AnchorBV.Velocity = Vector3.new(0,0,0)
  51. AnchorBV.MaxForce = Vector3.new(Force, Force, Force)
  52. AnchorBV.Parent = Drone
  53.  
  54. local DroneBP = Instance.new("BodyPosition")
  55. DroneBP.MaxForce = Vector3.new(0,0,0)
  56. DroneBP.Parent = Drone
  57.  
  58. local DroneBG = Drone:FindFirstChild("FlightGyro")
  59.  
  60. local function PlayerView()
  61. _G.CurrentView = "Player"
  62. local Character = Player.Character
  63. local Humanoid = Character:WaitForChild("Humanoid")
  64. Camera.CameraSubject = Humanoid
  65. Humanoid.WalkSpeed = 16
  66. Humanoid.JumpPower = 50
  67. DroneBG.MaxTorque = Vector3.new(0,0,0)
  68. DroneBV.MaxForce = Vector3.new(0,0,0)
  69. ClientGui.Enabled = true
  70. end
  71.  
  72. local function DroneView()
  73. local Character = Player.Character
  74. local Humanoid = Character:WaitForChild("Humanoid")
  75. _G.CurrentView = "Drone"
  76. Camera.CameraSubject = DroneCam
  77. Humanoid.WalkSpeed = 0
  78. Humanoid.JumpPower = 0
  79. DroneBG.MaxTorque = Vector3.new(Torque, Torque, Torque)
  80. DroneBV.MaxForce = Vector3.new(Force, Force, Force)
  81. end
  82.  
  83. ToggleViewButton.MouseButton1Click:Connect(function()
  84. if _G.CurrentView == "Drone" then
  85. PlayerView()
  86. elseif _G.CurrentView == "Player" then
  87. DroneView()
  88. end
  89. end)
  90.  
  91. ToggleFollowButton.MouseButton1Click:Connect(function()
  92. if not Following then
  93. Following = true
  94. DroneBG.MaxTorque = Vector3.new(Torque, Torque, Torque)
  95. DroneBP.MaxForce = Vector3.new(BPForce, BPForce, BPForce)
  96. else
  97. Following = false
  98. if _G.CurrentView == "Player" then
  99. DroneBG.MaxTorque = Vector3.new(0,0,0)
  100. end
  101. DroneBP.MaxForce = Vector3.new(0,0,0)
  102. end
  103. end)
  104.  
  105. RunService.RenderStepped:Connect(function()
  106. if Following then
  107. local Character = Player.Character
  108. local Humanoid = Character:WaitForChild("Humanoid")
  109. DroneBP.Position = (Character:GetPrimaryPartCFrame() * CFrame.new(4,5,0)).p
  110. end
  111. end)
  112. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement