Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local RunService = game:GetService("RunService")
- local Player = game.Players.LocalPlayer
- local PlayerGui = Player.PlayerGui
- local Camera = workspace.CurrentCamera
- local Character = Player.Character
- local Humanoid = Character:WaitForChild("Humanoid")
- local Drone = workspace.Drones:FindFirstChild(Character.Name)
- local ClientGui = PlayerGui:WaitForChild("Client")
- local Button = Instance.new("TextButton")
- Button.BackgroundColor3 = Color3.fromRGB(33,33,33)
- Button.TextColor3 = Color3.fromRGB(255,255,255)
- Button.TextSize = 20
- Button.Font = Enum.Font.SourceSansBold
- Button.Text = "Toggle"
- Button.Size = UDim2.new(0.1,0,0.048, 0)
- Button.Position = UDim2.new(0.008, 0, 0.861, 0)
- local Torque = 400000
- local Force = 4000
- local BPForce = 5000
- local Following = false
- if Drone then
- -- printoutput("Drone found")
- --UI
- local Gui = Instance.new("ScreenGui")
- Gui.Parent = game.CoreGui
- Gui.Name = "DroneSense"
- local ToggleViewButton = Button:Clone()
- ToggleViewButton.Text = "ToggleView"
- ToggleViewButton.Parent = Gui
- local ToggleFollowButton = Button:Clone()
- ToggleFollowButton.Text = "ToggleFollow"
- ToggleFollowButton.Position = UDim2.new(0.008, 0, 0.801, 0)
- ToggleFollowButton.Parent = Gui
- _G.CurrentView = "Drone"
- local DroneCam = Drone:FindFirstChild("Cam")
- local DroneBV = Drone:FindFirstChild("FlightVelocity")
- local AnchorBV = DroneBV:Clone() --To keep drone suspended but not moving.
- AnchorBV.Name = "Anchor"
- AnchorBV.Velocity = Vector3.new(0,0,0)
- AnchorBV.MaxForce = Vector3.new(Force, Force, Force)
- AnchorBV.Parent = Drone
- local DroneBP = Instance.new("BodyPosition")
- DroneBP.MaxForce = Vector3.new(0,0,0)
- DroneBP.Parent = Drone
- local DroneBG = Drone:FindFirstChild("FlightGyro")
- local function PlayerView()
- _G.CurrentView = "Player"
- local Character = Player.Character
- local Humanoid = Character:WaitForChild("Humanoid")
- Camera.CameraSubject = Humanoid
- Humanoid.WalkSpeed = 16
- Humanoid.JumpPower = 50
- DroneBG.MaxTorque = Vector3.new(0,0,0)
- DroneBV.MaxForce = Vector3.new(0,0,0)
- ClientGui.Enabled = true
- end
- local function DroneView()
- local Character = Player.Character
- local Humanoid = Character:WaitForChild("Humanoid")
- _G.CurrentView = "Drone"
- Camera.CameraSubject = DroneCam
- Humanoid.WalkSpeed = 0
- Humanoid.JumpPower = 0
- DroneBG.MaxTorque = Vector3.new(Torque, Torque, Torque)
- DroneBV.MaxForce = Vector3.new(Force, Force, Force)
- end
- ToggleViewButton.MouseButton1Click:Connect(function()
- if _G.CurrentView == "Drone" then
- PlayerView()
- elseif _G.CurrentView == "Player" then
- DroneView()
- end
- end)
- ToggleFollowButton.MouseButton1Click:Connect(function()
- if not Following then
- Following = true
- DroneBG.MaxTorque = Vector3.new(Torque, Torque, Torque)
- DroneBP.MaxForce = Vector3.new(BPForce, BPForce, BPForce)
- else
- Following = false
- if _G.CurrentView == "Player" then
- DroneBG.MaxTorque = Vector3.new(0,0,0)
- end
- DroneBP.MaxForce = Vector3.new(0,0,0)
- end
- end)
- RunService.RenderStepped:Connect(function()
- if Following then
- local Character = Player.Character
- local Humanoid = Character:WaitForChild("Humanoid")
- DroneBP.Position = (Character:GetPrimaryPartCFrame() * CFrame.new(4,5,0)).p
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement