Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local UserInputService = game:GetService("UserInputService")
- local runService = game:GetService("RunService")
- local inc = 1
- local w, a, s, d, e, q = false, false, false, false, false, false
- local LocalPlayer = game.Players.LocalPlayer
- local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
- local DroneAssets = {
- Propeller = {
- TextureId = "rbxassetid://838008963",
- MeshId = "rbxassetid://838008822",
- Size = Vector3.new(0.617, 0.324, 0.698)
- },
- Body = {
- TextureId = "rbxassetid://838007741",
- MeshId = "rbxassetid://838007583",
- Size = Vector3.new(2.723, 0.486, 2.637)
- }
- }
- --Build Drone
- local Drone = Instance.new("Part")
- Drone.Anchored = true
- Drone.Transparency = 1
- Drone.CFrame = Character:WaitForChild("Head").CFrame
- Drone.CanCollide = false
- Drone.Size = Vector3.new(0, 0, 0)
- Drone.Name = "Drone"
- local Light = Instance.new("PointLight")
- Light.Range = 100
- Light.Parent = Drone
- Drone.Parent = workspace
- --Sync Controls
- UserInputService.InputBegan:Connect(function(input, gpe)
- if input.UserInputType == Enum.UserInputType.Keyboard and not gpe then
- local Keycode = input.KeyCode
- if Keycode == Enum.KeyCode.W then
- w = true
- while runService.Heartbeat:Wait() and w do
- Drone.CFrame = Drone.CFrame * CFrame.new(0, 0, inc)
- end
- elseif Keycode == Enum.KeyCode.A then
- a = true
- while runService.Heartbeat:Wait() and a do
- Drone.CFrame = Drone.CFrame * CFrame.new(inc, 0, 0)
- end
- elseif Keycode == Enum.KeyCode.D then
- d = true
- while runService.Heartbeat:Wait() and d do
- Drone.CFrame = Drone.CFrame * CFrame.new(-inc, 0, 0)
- end
- elseif Keycode == Enum.KeyCode.S then
- s = true
- while runService.Heartbeat:Wait() and s do
- Drone.CFrame = Drone.CFrame * CFrame.new(0, 0, -inc)
- end
- elseif Keycode == Enum.KeyCode.E then
- e = true
- while runService.Heartbeat:Wait() and e do
- Drone.CFrame = Drone.CFrame * CFrame.new(0, inc, 0)
- end
- elseif Keycode == Enum.KeyCode.Q then
- q = true
- while runService.Heartbeat:Wait() and q do
- Drone.CFrame = Drone.CFrame * CFrame.new(0, -inc, 0)
- end
- elseif Keycode == Enum.KeyCode.X then
- Light.Enabled = not Light.Enabled
- end
- end
- end)
- UserInputService.InputEnded:Connect(function(input, gpe)
- if input.UserInputType == Enum.UserInputType.Keyboard and not gpe then
- local Keycode = input.KeyCode
- if Keycode == Enum.KeyCode.W then
- w = false
- elseif Keycode == Enum.KeyCode.A then
- a = false
- elseif Keycode == Enum.KeyCode.D then
- d = false
- elseif Keycode == Enum.KeyCode.S then
- s = false
- elseif Keycode == Enum.KeyCode.E then
- e = false
- elseif Keycode == Enum.KeyCode.Q then
- q = false
- end
- end
- end)
- workspace.Camera.CameraSubject = Drone
- while runService.Heartbeat:Wait() do
- Drone.CFrame = CFrame.new(Drone.CFrame.p, workspace.Camera.CFrame.p)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement