Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. local UserInputService = game:GetService("UserInputService")
  2. local runService = game:GetService("RunService")
  3. local inc = 1
  4. local w, a, s, d, e, q = false, false, false, false, false, false
  5.  
  6. local LocalPlayer = game.Players.LocalPlayer
  7. local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
  8.  
  9. local DroneAssets = {
  10. Propeller = {
  11. TextureId = "rbxassetid://838008963",
  12. MeshId = "rbxassetid://838008822",
  13. Size = Vector3.new(0.617, 0.324, 0.698)
  14. },
  15. Body = {
  16. TextureId = "rbxassetid://838007741",
  17. MeshId = "rbxassetid://838007583",
  18. Size = Vector3.new(2.723, 0.486, 2.637)
  19. }
  20. }
  21.  
  22. --Build Drone
  23.  
  24. local Drone = Instance.new("Part")
  25. Drone.Anchored = true
  26. Drone.Transparency = 1
  27. Drone.CFrame = Character:WaitForChild("Head").CFrame
  28. Drone.CanCollide = false
  29. Drone.Size = Vector3.new(0, 0, 0)
  30. Drone.Name = "Drone"
  31.  
  32. local Light = Instance.new("PointLight")
  33. Light.Range = 100
  34.  
  35. Light.Parent = Drone
  36.  
  37. Drone.Parent = workspace
  38.  
  39. --Sync Controls
  40.  
  41. UserInputService.InputBegan:Connect(function(input, gpe)
  42. if input.UserInputType == Enum.UserInputType.Keyboard and not gpe then
  43. local Keycode = input.KeyCode
  44.  
  45. if Keycode == Enum.KeyCode.W then
  46. w = true
  47. while runService.Heartbeat:Wait() and w do
  48. Drone.CFrame = Drone.CFrame * CFrame.new(0, 0, inc)
  49. end
  50. elseif Keycode == Enum.KeyCode.A then
  51. a = true
  52. while runService.Heartbeat:Wait() and a do
  53. Drone.CFrame = Drone.CFrame * CFrame.new(inc, 0, 0)
  54. end
  55. elseif Keycode == Enum.KeyCode.D then
  56. d = true
  57. while runService.Heartbeat:Wait() and d do
  58. Drone.CFrame = Drone.CFrame * CFrame.new(-inc, 0, 0)
  59. end
  60. elseif Keycode == Enum.KeyCode.S then
  61. s = true
  62. while runService.Heartbeat:Wait() and s do
  63. Drone.CFrame = Drone.CFrame * CFrame.new(0, 0, -inc)
  64. end
  65. elseif Keycode == Enum.KeyCode.E then
  66. e = true
  67. while runService.Heartbeat:Wait() and e do
  68. Drone.CFrame = Drone.CFrame * CFrame.new(0, inc, 0)
  69. end
  70. elseif Keycode == Enum.KeyCode.Q then
  71. q = true
  72. while runService.Heartbeat:Wait() and q do
  73. Drone.CFrame = Drone.CFrame * CFrame.new(0, -inc, 0)
  74. end
  75. elseif Keycode == Enum.KeyCode.X then
  76. Light.Enabled = not Light.Enabled
  77. end
  78.  
  79. end
  80. end)
  81.  
  82. UserInputService.InputEnded:Connect(function(input, gpe)
  83. if input.UserInputType == Enum.UserInputType.Keyboard and not gpe then
  84. local Keycode = input.KeyCode
  85.  
  86. if Keycode == Enum.KeyCode.W then
  87. w = false
  88. elseif Keycode == Enum.KeyCode.A then
  89. a = false
  90. elseif Keycode == Enum.KeyCode.D then
  91. d = false
  92. elseif Keycode == Enum.KeyCode.S then
  93. s = false
  94. elseif Keycode == Enum.KeyCode.E then
  95. e = false
  96. elseif Keycode == Enum.KeyCode.Q then
  97. q = false
  98. end
  99.  
  100. end
  101. end)
  102.  
  103. workspace.Camera.CameraSubject = Drone
  104.  
  105. while runService.Heartbeat:Wait() do
  106. Drone.CFrame = CFrame.new(Drone.CFrame.p, workspace.Camera.CFrame.p)
  107. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement